{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## DAY8 `value_counts` 全解\n",
    "\n",
    "https://pandas.pydata.org/docs/reference/api/pandas.Series.value_counts.html"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1. 基本语法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 注意：笔记里的url不能直接放到这里，比如点击raw进入下面的url才可以！\n",
    "url = 'https://raw.githubusercontent.com/datoujinggzj/DataScienceCrashCourse/master/data/Iris.csv'\n",
    "df_iris = pd.read_csv(url)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_sample = df_iris.sample(n = 100,\n",
    "          weights = [20]*50+[50]*50+[30]*50,\n",
    "          random_state=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Id</th>\n",
       "      <th>SepalLengthCm</th>\n",
       "      <th>SepalWidthCm</th>\n",
       "      <th>PetalLengthCm</th>\n",
       "      <th>PetalWidthCm</th>\n",
       "      <th>Species</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>71</th>\n",
       "      <td>72</td>\n",
       "      <td>6.1</td>\n",
       "      <td>2.8</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.3</td>\n",
       "      <td>Iris-versicolor</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>103</th>\n",
       "      <td>104</td>\n",
       "      <td>6.3</td>\n",
       "      <td>2.9</td>\n",
       "      <td>5.6</td>\n",
       "      <td>1.8</td>\n",
       "      <td>Iris-virginica</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>5.1</td>\n",
       "      <td>3.5</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60</th>\n",
       "      <td>61</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3.5</td>\n",
       "      <td>1.0</td>\n",
       "      <td>Iris-versicolor</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>37</td>\n",
       "      <td>5.5</td>\n",
       "      <td>3.5</td>\n",
       "      <td>1.3</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>78</th>\n",
       "      <td>79</td>\n",
       "      <td>6.0</td>\n",
       "      <td>2.9</td>\n",
       "      <td>4.5</td>\n",
       "      <td>1.5</td>\n",
       "      <td>Iris-versicolor</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>23</td>\n",
       "      <td>4.6</td>\n",
       "      <td>3.6</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>12</td>\n",
       "      <td>4.8</td>\n",
       "      <td>3.4</td>\n",
       "      <td>1.6</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>20</td>\n",
       "      <td>5.1</td>\n",
       "      <td>3.8</td>\n",
       "      <td>1.5</td>\n",
       "      <td>0.3</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>9</td>\n",
       "      <td>4.4</td>\n",
       "      <td>2.9</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 6 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      Id  SepalLengthCm  SepalWidthCm  PetalLengthCm  PetalWidthCm  \\\n",
       "71    72            6.1           2.8            4.0           1.3   \n",
       "103  104            6.3           2.9            5.6           1.8   \n",
       "0      1            5.1           3.5            1.4           0.2   \n",
       "60    61            5.0           2.0            3.5           1.0   \n",
       "36    37            5.5           3.5            1.3           0.2   \n",
       "..   ...            ...           ...            ...           ...   \n",
       "78    79            6.0           2.9            4.5           1.5   \n",
       "22    23            4.6           3.6            1.0           0.2   \n",
       "11    12            4.8           3.4            1.6           0.2   \n",
       "19    20            5.1           3.8            1.5           0.3   \n",
       "8      9            4.4           2.9            1.4           0.2   \n",
       "\n",
       "             Species  \n",
       "71   Iris-versicolor  \n",
       "103   Iris-virginica  \n",
       "0        Iris-setosa  \n",
       "60   Iris-versicolor  \n",
       "36       Iris-setosa  \n",
       "..               ...  \n",
       "78   Iris-versicolor  \n",
       "22       Iris-setosa  \n",
       "11       Iris-setosa  \n",
       "19       Iris-setosa  \n",
       "8        Iris-setosa  \n",
       "\n",
       "[100 rows x 6 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_sample"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Iris-versicolor    38\n",
       "Iris-virginica     33\n",
       "Iris-setosa        29\n",
       "Name: Species, dtype: int64"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_sample['Species'].value_counts()\n",
    "\n",
    "# 返回每一类有多少个"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "pandas.core.series.Series"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(df_sample['Species'].value_counts())\n",
    "# 返回的是一个series"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2. 参数解析"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2.1 ascending"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Iris-setosa        29\n",
       "Iris-virginica     33\n",
       "Iris-versicolor    38\n",
       "Name: Species, dtype: int64"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_sample['Species'].value_counts(ascending=True)\n",
    "# 升序排列，默认是倒序"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2.2 dropna"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Iris-setosa       29\n",
       "Iris-virginica    33\n",
       "Name: Species, dtype: int64"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test1 = df_sample['Species'].replace({'Iris-versicolor':np.nan})\n",
    "# test1是为了尝试一下nan是否会被value_counts抓取\n",
    "\n",
    "test1.value_counts(ascending=True)\n",
    "# nan没有被count出来"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Iris-setosa       29\n",
       "Iris-virginica    33\n",
       "NaN               38\n",
       "Name: Species, dtype: int64"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test1.value_counts(ascending=True,\n",
    "                   dropna = False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2.3 normalize"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Iris-setosa       0.29\n",
       "Iris-virginica    0.33\n",
       "NaN               0.38\n",
       "Name: Species, dtype: float64"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test1.value_counts(ascending=True,\n",
    "                   dropna = False,\n",
    "                  normalize = True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2.4 百分比"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Iris-setosa      29%\n",
       "Iris-virginica   33%\n",
       "NaN              38%\n",
       "Name: Species, dtype: float64"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.set_option('display.float_format', '{:.0f}%'.format)\n",
    "test1.value_counts(ascending=True,\n",
    "                   dropna = False,\n",
    "                  normalize = True)*100"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "pd.reset_option('display.float_format')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style type=\"text/css\">\n",
       "</style>\n",
       "<table id=\"T_a360e\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th class=\"blank level0\" >&nbsp;</th>\n",
       "      <th id=\"T_a360e_level0_col0\" class=\"col_heading level0 col0\" >Species</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th id=\"T_a360e_level0_row0\" class=\"row_heading level0 row0\" >Iris-virginica</th>\n",
       "      <td id=\"T_a360e_row0_col0\" class=\"data row0 col0\" >53.23%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_a360e_level0_row1\" class=\"row_heading level0 row1\" >Iris-setosa</th>\n",
       "      <td id=\"T_a360e_row1_col0\" class=\"data row1 col0\" >46.77%</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x21a2b3d7a00>"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test1.value_counts(normalize = True).to_frame().style.format('{:.2%}')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2.5 bins"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(50.667, 100.333]    38\n",
       "(100.333, 150.0]     33\n",
       "(0.85, 50.667]       29\n",
       "Name: Id, dtype: int64"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_sample.Id.value_counts(bins=3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(10.0, 80.0]      44\n",
       "(100.0, 150.0]    33\n",
       "(80.0, 100.0]     16\n",
       "(-0.001, 10.0]     7\n",
       "Name: Id, dtype: int64"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_sample.Id.value_counts(bins=[0,10,80,100,150])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:>"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "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\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "df_sample.Id.value_counts(bins=[0,10,80,100,150]).plot(kind='bar',rot=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Id</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>(50.667, 100.333]</th>\n",
       "      <td>38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>(100.333, 150.0]</th>\n",
       "      <td>33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>(0.85, 50.667]</th>\n",
       "      <td>29</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   Id\n",
       "(50.667, 100.333]  38\n",
       "(100.333, 150.0]   33\n",
       "(0.85, 50.667]     29"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_sample.Id.value_counts(bins=3).to_frame()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    " ## 补充 `style.format` 使用（讲解在DAY8 solution中）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 下载引用即可\n",
    "\n",
    "# read_csv的时候就进行清洗\n",
    "df = pd.read_csv('./data/Salaries.gz',low_memory=False) \\\n",
    "       .replace('Not Provided', np.nan)\\\n",
    "       .astype({\"BasePay\":float, \"OtherPay\":float, \"OvertimePay\":float})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 设置options\n",
    "\n",
    "pd.set_option('display.max_colwidth',40)\n",
    "pd.set_option('display.precision',3)\n",
    "pd.set_option('display.max_rows',6)\n",
    "pd.set_option('display.max_columns',6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Id</th>\n",
       "      <th>EmployeeName</th>\n",
       "      <th>JobTitle</th>\n",
       "      <th>...</th>\n",
       "      <th>Notes</th>\n",
       "      <th>Agency</th>\n",
       "      <th>Status</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>NATHANIEL FORD</td>\n",
       "      <td>GENERAL MANAGER-METROPOLITAN TRANSIT...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>San Francisco</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>GARY JIMENEZ</td>\n",
       "      <td>CAPTAIN III (POLICE DEPARTMENT)</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>San Francisco</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>ALBERT PARDINI</td>\n",
       "      <td>CAPTAIN III (POLICE DEPARTMENT)</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>San Francisco</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>148651</th>\n",
       "      <td>148652</td>\n",
       "      <td>Not provided</td>\n",
       "      <td>Not provided</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>San Francisco</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>148652</th>\n",
       "      <td>148653</td>\n",
       "      <td>Not provided</td>\n",
       "      <td>Not provided</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>San Francisco</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>148653</th>\n",
       "      <td>148654</td>\n",
       "      <td>Joe Lopez</td>\n",
       "      <td>Counselor, Log Cabin Ranch</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>San Francisco</td>\n",
       "      <td>PT</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>148654 rows × 13 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            Id    EmployeeName                                 JobTitle  ...  \\\n",
       "0            1  NATHANIEL FORD  GENERAL MANAGER-METROPOLITAN TRANSIT...  ...   \n",
       "1            2    GARY JIMENEZ          CAPTAIN III (POLICE DEPARTMENT)  ...   \n",
       "2            3  ALBERT PARDINI          CAPTAIN III (POLICE DEPARTMENT)  ...   \n",
       "...        ...             ...                                      ...  ...   \n",
       "148651  148652    Not provided                             Not provided  ...   \n",
       "148652  148653    Not provided                             Not provided  ...   \n",
       "148653  148654       Joe Lopez               Counselor, Log Cabin Ranch  ...   \n",
       "\n",
       "        Notes         Agency  Status  \n",
       "0         NaN  San Francisco     NaN  \n",
       "1         NaN  San Francisco     NaN  \n",
       "2         NaN  San Francisco     NaN  \n",
       "...       ...            ...     ...  \n",
       "148651    NaN  San Francisco     NaN  \n",
       "148652    NaN  San Francisco     NaN  \n",
       "148653    NaN  San Francisco      PT  \n",
       "\n",
       "[148654 rows x 13 columns]"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style type=\"text/css\">\n",
       "</style>\n",
       "<table id=\"T_abcae\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th class=\"blank level0\" >&nbsp;</th>\n",
       "      <th id=\"T_abcae_level0_col0\" class=\"col_heading level0 col0\" >BasePay</th>\n",
       "      <th id=\"T_abcae_level0_col1\" class=\"col_heading level0 col1\" >OtherPay</th>\n",
       "      <th id=\"T_abcae_level0_col2\" class=\"col_heading level0 col2\" >TotalPay</th>\n",
       "      <th id=\"T_abcae_level0_col3\" class=\"col_heading level0 col3\" >TotalPayBenefits</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th id=\"T_abcae_level0_row0\" class=\"row_heading level0 row0\" >0</th>\n",
       "      <td id=\"T_abcae_row0_col0\" class=\"data row0 col0\" >$             167,411</td>\n",
       "      <td id=\"T_abcae_row0_col1\" class=\"data row0 col1\" >$             400,184</td>\n",
       "      <td id=\"T_abcae_row0_col2\" class=\"data row0 col2\" >$             567,595</td>\n",
       "      <td id=\"T_abcae_row0_col3\" class=\"data row0 col3\" >$             567,595</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_abcae_level0_row1\" class=\"row_heading level0 row1\" >1</th>\n",
       "      <td id=\"T_abcae_row1_col0\" class=\"data row1 col0\" >$             155,966</td>\n",
       "      <td id=\"T_abcae_row1_col1\" class=\"data row1 col1\" >$             137,811</td>\n",
       "      <td id=\"T_abcae_row1_col2\" class=\"data row1 col2\" >$             538,909</td>\n",
       "      <td id=\"T_abcae_row1_col3\" class=\"data row1 col3\" >$             538,909</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_abcae_level0_row2\" class=\"row_heading level0 row2\" >2</th>\n",
       "      <td id=\"T_abcae_row2_col0\" class=\"data row2 col0\" >$             212,739</td>\n",
       "      <td id=\"T_abcae_row2_col1\" class=\"data row2 col1\" >$              16,453</td>\n",
       "      <td id=\"T_abcae_row2_col2\" class=\"data row2 col2\" >$             335,280</td>\n",
       "      <td id=\"T_abcae_row2_col3\" class=\"data row2 col3\" >$             335,280</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x21a2db11d00>"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head(3)[[\"BasePay\",\"OtherPay\",\"TotalPay\",\"TotalPayBenefits\"]]\\\n",
    "            .style.format({\"BasePay\": \"${:20,.0f}\", \n",
    "                          \"OtherPay\": \"${:20,.0f}\", \n",
    "                          \"TotalPay\": \"${:20,.0f}\",\n",
    "                          \"TotalPayBenefits\":\"${:20,.0f}\"})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style type=\"text/css\">\n",
       "</style>\n",
       "<table id=\"T_8e4b7\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th class=\"blank level0\" >&nbsp;</th>\n",
       "      <th id=\"T_8e4b7_level0_col0\" class=\"col_heading level0 col0\" >BasePay</th>\n",
       "      <th id=\"T_8e4b7_level0_col1\" class=\"col_heading level0 col1\" >OtherPay</th>\n",
       "      <th id=\"T_8e4b7_level0_col2\" class=\"col_heading level0 col2\" >TotalPay</th>\n",
       "      <th id=\"T_8e4b7_level0_col3\" class=\"col_heading level0 col3\" >TotalPayBenefits</th>\n",
       "      <th id=\"T_8e4b7_level0_col4\" class=\"col_heading level0 col4\" >JobTitle</th>\n",
       "      <th id=\"T_8e4b7_level0_col5\" class=\"col_heading level0 col5\" >EmployeeName</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th id=\"T_8e4b7_level0_row0\" class=\"row_heading level0 row0\" >0</th>\n",
       "      <td id=\"T_8e4b7_row0_col0\" class=\"data row0 col0\" >$             167,411</td>\n",
       "      <td id=\"T_8e4b7_row0_col1\" class=\"data row0 col1\" >$             400,184</td>\n",
       "      <td id=\"T_8e4b7_row0_col2\" class=\"data row0 col2\" >$             567,595</td>\n",
       "      <td id=\"T_8e4b7_row0_col3\" class=\"data row0 col3\" >$             567,595</td>\n",
       "      <td id=\"T_8e4b7_row0_col4\" class=\"data row0 col4\" >general manager-metropolitan transit authority</td>\n",
       "      <td id=\"T_8e4b7_row0_col5\" class=\"data row0 col5\" >NATHANIEL FORD</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_8e4b7_level0_row1\" class=\"row_heading level0 row1\" >1</th>\n",
       "      <td id=\"T_8e4b7_row1_col0\" class=\"data row1 col0\" >$             155,966</td>\n",
       "      <td id=\"T_8e4b7_row1_col1\" class=\"data row1 col1\" >$             137,811</td>\n",
       "      <td id=\"T_8e4b7_row1_col2\" class=\"data row1 col2\" >$             538,909</td>\n",
       "      <td id=\"T_8e4b7_row1_col3\" class=\"data row1 col3\" >$             538,909</td>\n",
       "      <td id=\"T_8e4b7_row1_col4\" class=\"data row1 col4\" >captain iii (police department)</td>\n",
       "      <td id=\"T_8e4b7_row1_col5\" class=\"data row1 col5\" >GARY JIMENEZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_8e4b7_level0_row2\" class=\"row_heading level0 row2\" >2</th>\n",
       "      <td id=\"T_8e4b7_row2_col0\" class=\"data row2 col0\" >$             212,739</td>\n",
       "      <td id=\"T_8e4b7_row2_col1\" class=\"data row2 col1\" >$              16,453</td>\n",
       "      <td id=\"T_8e4b7_row2_col2\" class=\"data row2 col2\" >$             335,280</td>\n",
       "      <td id=\"T_8e4b7_row2_col3\" class=\"data row2 col3\" >$             335,280</td>\n",
       "      <td id=\"T_8e4b7_row2_col4\" class=\"data row2 col4\" >captain iii (police department)</td>\n",
       "      <td id=\"T_8e4b7_row2_col5\" class=\"data row2 col5\" >ALBERT PARDINI</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x21a2db1fcd0>"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head(3)[[\"BasePay\",\"OtherPay\",\"TotalPay\",\"TotalPayBenefits\",\"JobTitle\",\"EmployeeName\"]]\\\n",
    "            .style.format({\"JobTitle\": lambda x:x.lower(),\n",
    "                          \"EmployeeName\": lambda x:x.upper(),\n",
    "                          \"BasePay\": \"${:20,.0f}\", \n",
    "                          \"OtherPay\": \"${:20,.0f}\", \n",
    "                          \"TotalPay\": \"${:20,.0f}\",\n",
    "                          \"TotalPayBenefits\":\"${:20,.0f}\"})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style type=\"text/css\">\n",
       "</style>\n",
       "<table id=\"T_4d4fb\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th id=\"T_4d4fb_level0_col0\" class=\"col_heading level0 col0\" >BasePay</th>\n",
       "      <th id=\"T_4d4fb_level0_col1\" class=\"col_heading level0 col1\" >OtherPay</th>\n",
       "      <th id=\"T_4d4fb_level0_col2\" class=\"col_heading level0 col2\" >TotalPay</th>\n",
       "      <th id=\"T_4d4fb_level0_col3\" class=\"col_heading level0 col3\" >TotalPayBenefits</th>\n",
       "      <th id=\"T_4d4fb_level0_col4\" class=\"col_heading level0 col4\" >JobTitle</th>\n",
       "      <th id=\"T_4d4fb_level0_col5\" class=\"col_heading level0 col5\" >EmployeeName</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td id=\"T_4d4fb_row0_col0\" class=\"data row0 col0\" >$             167,411</td>\n",
       "      <td id=\"T_4d4fb_row0_col1\" class=\"data row0 col1\" >$             400,184</td>\n",
       "      <td id=\"T_4d4fb_row0_col2\" class=\"data row0 col2\" >$             567,595</td>\n",
       "      <td id=\"T_4d4fb_row0_col3\" class=\"data row0 col3\" >$             567,595</td>\n",
       "      <td id=\"T_4d4fb_row0_col4\" class=\"data row0 col4\" >general manager-metropolitan transit authority</td>\n",
       "      <td id=\"T_4d4fb_row0_col5\" class=\"data row0 col5\" >NATHANIEL FORD</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_4d4fb_row1_col0\" class=\"data row1 col0\" >$             155,966</td>\n",
       "      <td id=\"T_4d4fb_row1_col1\" class=\"data row1 col1\" >$             137,811</td>\n",
       "      <td id=\"T_4d4fb_row1_col2\" class=\"data row1 col2\" >$             538,909</td>\n",
       "      <td id=\"T_4d4fb_row1_col3\" class=\"data row1 col3\" >$             538,909</td>\n",
       "      <td id=\"T_4d4fb_row1_col4\" class=\"data row1 col4\" >captain iii (police department)</td>\n",
       "      <td id=\"T_4d4fb_row1_col5\" class=\"data row1 col5\" >GARY JIMENEZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_4d4fb_row2_col0\" class=\"data row2 col0\" >$             212,739</td>\n",
       "      <td id=\"T_4d4fb_row2_col1\" class=\"data row2 col1\" >$              16,453</td>\n",
       "      <td id=\"T_4d4fb_row2_col2\" class=\"data row2 col2\" >$             335,280</td>\n",
       "      <td id=\"T_4d4fb_row2_col3\" class=\"data row2 col3\" >$             335,280</td>\n",
       "      <td id=\"T_4d4fb_row2_col4\" class=\"data row2 col4\" >captain iii (police department)</td>\n",
       "      <td id=\"T_4d4fb_row2_col5\" class=\"data row2 col5\" >ALBERT PARDINI</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x21a2db26880>"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head(3)[[\"BasePay\",\"OtherPay\",\"TotalPay\",\"TotalPayBenefits\",\"JobTitle\",\"EmployeeName\"]]\\\n",
    "            .style.format({\"JobTitle\": lambda x:x.lower(),\n",
    "                          \"EmployeeName\": lambda x:x.upper(),\n",
    "                          \"BasePay\": \"${:20,.0f}\", \n",
    "                          \"OtherPay\": \"${:20,.0f}\", \n",
    "                          \"TotalPay\": \"${:20,.0f}\",\n",
    "                          \"TotalPayBenefits\":\"${:20,.0f}\"})\\\n",
    "                  .hide(axis='index')\\\n",
    "                 # .hide(axis='columns')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style type=\"text/css\">\n",
       "#T_4598f_row0_col1, #T_4598f_row0_col2, #T_4598f_row0_col3, #T_4598f_row0_col4, #T_4598f_row0_col5, #T_4598f_row2_col0 {\n",
       "  background-color: #ff8725;\n",
       "}\n",
       "#T_4598f_row1_col0, #T_4598f_row1_col4, #T_4598f_row2_col1, #T_4598f_row2_col2, #T_4598f_row2_col3, #T_4598f_row2_col4, #T_4598f_row2_col5 {\n",
       "  background-color: #90ee90;\n",
       "}\n",
       "</style>\n",
       "<table id=\"T_4598f\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th id=\"T_4598f_level0_col0\" class=\"col_heading level0 col0\" >BasePay</th>\n",
       "      <th id=\"T_4598f_level0_col1\" class=\"col_heading level0 col1\" >OtherPay</th>\n",
       "      <th id=\"T_4598f_level0_col2\" class=\"col_heading level0 col2\" >TotalPay</th>\n",
       "      <th id=\"T_4598f_level0_col3\" class=\"col_heading level0 col3\" >TotalPayBenefits</th>\n",
       "      <th id=\"T_4598f_level0_col4\" class=\"col_heading level0 col4\" >JobTitle</th>\n",
       "      <th id=\"T_4598f_level0_col5\" class=\"col_heading level0 col5\" >EmployeeName</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td id=\"T_4598f_row0_col0\" class=\"data row0 col0\" >$             167,411</td>\n",
       "      <td id=\"T_4598f_row0_col1\" class=\"data row0 col1\" >$             400,184</td>\n",
       "      <td id=\"T_4598f_row0_col2\" class=\"data row0 col2\" >$             567,595</td>\n",
       "      <td id=\"T_4598f_row0_col3\" class=\"data row0 col3\" >$             567,595</td>\n",
       "      <td id=\"T_4598f_row0_col4\" class=\"data row0 col4\" >general manager-metropolitan transit authority</td>\n",
       "      <td id=\"T_4598f_row0_col5\" class=\"data row0 col5\" >NATHANIEL FORD</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_4598f_row1_col0\" class=\"data row1 col0\" >$             155,966</td>\n",
       "      <td id=\"T_4598f_row1_col1\" class=\"data row1 col1\" >$             137,811</td>\n",
       "      <td id=\"T_4598f_row1_col2\" class=\"data row1 col2\" >$             538,909</td>\n",
       "      <td id=\"T_4598f_row1_col3\" class=\"data row1 col3\" >$             538,909</td>\n",
       "      <td id=\"T_4598f_row1_col4\" class=\"data row1 col4\" >captain iii (police department)</td>\n",
       "      <td id=\"T_4598f_row1_col5\" class=\"data row1 col5\" >GARY JIMENEZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_4598f_row2_col0\" class=\"data row2 col0\" >$             212,739</td>\n",
       "      <td id=\"T_4598f_row2_col1\" class=\"data row2 col1\" >$              16,453</td>\n",
       "      <td id=\"T_4598f_row2_col2\" class=\"data row2 col2\" >$             335,280</td>\n",
       "      <td id=\"T_4598f_row2_col3\" class=\"data row2 col3\" >$             335,280</td>\n",
       "      <td id=\"T_4598f_row2_col4\" class=\"data row2 col4\" >captain iii (police department)</td>\n",
       "      <td id=\"T_4598f_row2_col5\" class=\"data row2 col5\" >ALBERT PARDINI</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x21a2db26fa0>"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head(3)[[\"BasePay\",\"OtherPay\",\"TotalPay\",\"TotalPayBenefits\",\"JobTitle\",\"EmployeeName\"]]\\\n",
    "            .style.format({\"JobTitle\": lambda x:x.lower(),\n",
    "                          \"EmployeeName\": lambda x:x.upper(),\n",
    "                          \"BasePay\": \"${:20,.0f}\", \n",
    "                          \"OtherPay\": \"${:20,.0f}\", \n",
    "                          \"TotalPay\": \"${:20,.0f}\",\n",
    "                          \"TotalPayBenefits\":\"${:20,.0f}\"})\\\n",
    "                  .hide(axis='index')\\\n",
    "                  .highlight_max(color='#ff8725')\\\n",
    "                  .highlight_min(color='#90ee90')           "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style type=\"text/css\">\n",
       "#T_d76e4_row0_col0, #T_d76e4_row4_col1 {\n",
       "  background-color: #fc8060;\n",
       "  color: #f1f1f1;\n",
       "}\n",
       "#T_d76e4_row0_col1, #T_d76e4_row0_col2, #T_d76e4_row0_col3, #T_d76e4_row9_col0 {\n",
       "  background-color: #67000d;\n",
       "  color: #f1f1f1;\n",
       "}\n",
       "#T_d76e4_row1_col0 {\n",
       "  background-color: #fc9272;\n",
       "  color: #000000;\n",
       "}\n",
       "#T_d76e4_row1_col1 {\n",
       "  background-color: #fca689;\n",
       "  color: #000000;\n",
       "}\n",
       "#T_d76e4_row1_col2, #T_d76e4_row1_col3 {\n",
       "  background-color: #9c0d14;\n",
       "  color: #f1f1f1;\n",
       "}\n",
       "#T_d76e4_row2_col0 {\n",
       "  background-color: #e83429;\n",
       "  color: #f1f1f1;\n",
       "}\n",
       "#T_d76e4_row2_col1, #T_d76e4_row3_col0, #T_d76e4_row9_col1, #T_d76e4_row9_col2, #T_d76e4_row9_col3 {\n",
       "  background-color: #fff5f0;\n",
       "  color: #000000;\n",
       "}\n",
       "#T_d76e4_row2_col2, #T_d76e4_row2_col3 {\n",
       "  background-color: #fee1d3;\n",
       "  color: #000000;\n",
       "}\n",
       "#T_d76e4_row3_col1 {\n",
       "  background-color: #fb7252;\n",
       "  color: #f1f1f1;\n",
       "}\n",
       "#T_d76e4_row3_col2, #T_d76e4_row3_col3 {\n",
       "  background-color: #fee3d6;\n",
       "  color: #000000;\n",
       "}\n",
       "#T_d76e4_row4_col0 {\n",
       "  background-color: #fcb499;\n",
       "  color: #000000;\n",
       "}\n",
       "#T_d76e4_row4_col2, #T_d76e4_row4_col3, #T_d76e4_row7_col1 {\n",
       "  background-color: #fee6da;\n",
       "  color: #000000;\n",
       "}\n",
       "#T_d76e4_row5_col0 {\n",
       "  background-color: #fdcbb6;\n",
       "  color: #000000;\n",
       "}\n",
       "#T_d76e4_row5_col1 {\n",
       "  background-color: #fb7a5a;\n",
       "  color: #f1f1f1;\n",
       "}\n",
       "#T_d76e4_row5_col2, #T_d76e4_row5_col3, #T_d76e4_row6_col2, #T_d76e4_row6_col3 {\n",
       "  background-color: #ffece4;\n",
       "  color: #000000;\n",
       "}\n",
       "#T_d76e4_row6_col0 {\n",
       "  background-color: #feeae0;\n",
       "  color: #000000;\n",
       "}\n",
       "#T_d76e4_row6_col1 {\n",
       "  background-color: #fca98c;\n",
       "  color: #000000;\n",
       "}\n",
       "#T_d76e4_row7_col0 {\n",
       "  background-color: #a91016;\n",
       "  color: #f1f1f1;\n",
       "}\n",
       "#T_d76e4_row7_col2, #T_d76e4_row7_col3 {\n",
       "  background-color: #fff2eb;\n",
       "  color: #000000;\n",
       "}\n",
       "#T_d76e4_row8_col0 {\n",
       "  background-color: #fb7151;\n",
       "  color: #f1f1f1;\n",
       "}\n",
       "#T_d76e4_row8_col1 {\n",
       "  background-color: #ffebe2;\n",
       "  color: #000000;\n",
       "}\n",
       "#T_d76e4_row8_col2, #T_d76e4_row8_col3 {\n",
       "  background-color: #fff4ef;\n",
       "  color: #000000;\n",
       "}\n",
       "</style>\n",
       "<table id=\"T_d76e4\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th id=\"T_d76e4_level0_col0\" class=\"col_heading level0 col0\" >BasePay</th>\n",
       "      <th id=\"T_d76e4_level0_col1\" class=\"col_heading level0 col1\" >OtherPay</th>\n",
       "      <th id=\"T_d76e4_level0_col2\" class=\"col_heading level0 col2\" >TotalPay</th>\n",
       "      <th id=\"T_d76e4_level0_col3\" class=\"col_heading level0 col3\" >TotalPayBenefits</th>\n",
       "      <th id=\"T_d76e4_level0_col4\" class=\"col_heading level0 col4\" >JobTitle</th>\n",
       "      <th id=\"T_d76e4_level0_col5\" class=\"col_heading level0 col5\" >EmployeeName</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td id=\"T_d76e4_row0_col0\" class=\"data row0 col0\" >$             167,411</td>\n",
       "      <td id=\"T_d76e4_row0_col1\" class=\"data row0 col1\" >$             400,184</td>\n",
       "      <td id=\"T_d76e4_row0_col2\" class=\"data row0 col2\" >$             567,595</td>\n",
       "      <td id=\"T_d76e4_row0_col3\" class=\"data row0 col3\" >$             567,595</td>\n",
       "      <td id=\"T_d76e4_row0_col4\" class=\"data row0 col4\" >general manager-metropolitan transit authority</td>\n",
       "      <td id=\"T_d76e4_row0_col5\" class=\"data row0 col5\" >NATHANIEL FORD</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_d76e4_row1_col0\" class=\"data row1 col0\" >$             155,966</td>\n",
       "      <td id=\"T_d76e4_row1_col1\" class=\"data row1 col1\" >$             137,811</td>\n",
       "      <td id=\"T_d76e4_row1_col2\" class=\"data row1 col2\" >$             538,909</td>\n",
       "      <td id=\"T_d76e4_row1_col3\" class=\"data row1 col3\" >$             538,909</td>\n",
       "      <td id=\"T_d76e4_row1_col4\" class=\"data row1 col4\" >captain iii (police department)</td>\n",
       "      <td id=\"T_d76e4_row1_col5\" class=\"data row1 col5\" >GARY JIMENEZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_d76e4_row2_col0\" class=\"data row2 col0\" >$             212,739</td>\n",
       "      <td id=\"T_d76e4_row2_col1\" class=\"data row2 col1\" >$              16,453</td>\n",
       "      <td id=\"T_d76e4_row2_col2\" class=\"data row2 col2\" >$             335,280</td>\n",
       "      <td id=\"T_d76e4_row2_col3\" class=\"data row2 col3\" >$             335,280</td>\n",
       "      <td id=\"T_d76e4_row2_col4\" class=\"data row2 col4\" >captain iii (police department)</td>\n",
       "      <td id=\"T_d76e4_row2_col5\" class=\"data row2 col5\" >ALBERT PARDINI</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_d76e4_row3_col0\" class=\"data row3 col0\" >$              77,916</td>\n",
       "      <td id=\"T_d76e4_row3_col1\" class=\"data row3 col1\" >$             198,307</td>\n",
       "      <td id=\"T_d76e4_row3_col2\" class=\"data row3 col2\" >$             332,344</td>\n",
       "      <td id=\"T_d76e4_row3_col3\" class=\"data row3 col3\" >$             332,344</td>\n",
       "      <td id=\"T_d76e4_row3_col4\" class=\"data row3 col4\" >wire rope cable maintenance mechanic</td>\n",
       "      <td id=\"T_d76e4_row3_col5\" class=\"data row3 col5\" >CHRISTOPHER CHONG</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_d76e4_row4_col0\" class=\"data row4 col0\" >$             134,402</td>\n",
       "      <td id=\"T_d76e4_row4_col1\" class=\"data row4 col1\" >$             182,235</td>\n",
       "      <td id=\"T_d76e4_row4_col2\" class=\"data row4 col2\" >$             326,373</td>\n",
       "      <td id=\"T_d76e4_row4_col3\" class=\"data row4 col3\" >$             326,373</td>\n",
       "      <td id=\"T_d76e4_row4_col4\" class=\"data row4 col4\" >deputy chief of department,(fire department)</td>\n",
       "      <td id=\"T_d76e4_row4_col5\" class=\"data row4 col5\" >PATRICK GARDNER</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_d76e4_row5_col0\" class=\"data row5 col0\" >$             118,602</td>\n",
       "      <td id=\"T_d76e4_row5_col1\" class=\"data row5 col1\" >$             189,083</td>\n",
       "      <td id=\"T_d76e4_row5_col2\" class=\"data row5 col2\" >$             316,286</td>\n",
       "      <td id=\"T_d76e4_row5_col3\" class=\"data row5 col3\" >$             316,286</td>\n",
       "      <td id=\"T_d76e4_row5_col4\" class=\"data row5 col4\" >assistant deputy chief ii</td>\n",
       "      <td id=\"T_d76e4_row5_col5\" class=\"data row5 col5\" >DAVID SULLIVAN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_d76e4_row6_col0\" class=\"data row6 col0\" >$              92,492</td>\n",
       "      <td id=\"T_d76e4_row6_col1\" class=\"data row6 col1\" >$             134,426</td>\n",
       "      <td id=\"T_d76e4_row6_col2\" class=\"data row6 col2\" >$             315,981</td>\n",
       "      <td id=\"T_d76e4_row6_col3\" class=\"data row6 col3\" >$             315,981</td>\n",
       "      <td id=\"T_d76e4_row6_col4\" class=\"data row6 col4\" >battalion chief, (fire department)</td>\n",
       "      <td id=\"T_d76e4_row6_col5\" class=\"data row6 col5\" >ALSON LEE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_d76e4_row7_col0\" class=\"data row7 col0\" >$             256,577</td>\n",
       "      <td id=\"T_d76e4_row7_col1\" class=\"data row7 col1\" >$              51,322</td>\n",
       "      <td id=\"T_d76e4_row7_col2\" class=\"data row7 col2\" >$             307,899</td>\n",
       "      <td id=\"T_d76e4_row7_col3\" class=\"data row7 col3\" >$             307,899</td>\n",
       "      <td id=\"T_d76e4_row7_col4\" class=\"data row7 col4\" >deputy director of investments</td>\n",
       "      <td id=\"T_d76e4_row7_col5\" class=\"data row7 col5\" >DAVID KUSHNER</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_d76e4_row8_col0\" class=\"data row8 col0\" >$             176,933</td>\n",
       "      <td id=\"T_d76e4_row8_col1\" class=\"data row8 col1\" >$              40,132</td>\n",
       "      <td id=\"T_d76e4_row8_col2\" class=\"data row8 col2\" >$             303,428</td>\n",
       "      <td id=\"T_d76e4_row8_col3\" class=\"data row8 col3\" >$             303,428</td>\n",
       "      <td id=\"T_d76e4_row8_col4\" class=\"data row8 col4\" >battalion chief, (fire department)</td>\n",
       "      <td id=\"T_d76e4_row8_col5\" class=\"data row8 col5\" >MICHAEL MORRIS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_d76e4_row9_col0\" class=\"data row9 col0\" >$             285,262</td>\n",
       "      <td id=\"T_d76e4_row9_col1\" class=\"data row9 col1\" >$              17,116</td>\n",
       "      <td id=\"T_d76e4_row9_col2\" class=\"data row9 col2\" >$             302,378</td>\n",
       "      <td id=\"T_d76e4_row9_col3\" class=\"data row9 col3\" >$             302,378</td>\n",
       "      <td id=\"T_d76e4_row9_col4\" class=\"data row9 col4\" >chief of department, (fire department)</td>\n",
       "      <td id=\"T_d76e4_row9_col5\" class=\"data row9 col5\" >JOANNE HAYES-WHITE</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x21a35065b80>"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head(10)[[\"BasePay\",\"OtherPay\",\"TotalPay\",\"TotalPayBenefits\",\"JobTitle\",\"EmployeeName\"]]\\\n",
    "            .style.format({\"JobTitle\": lambda x:x.lower(),\n",
    "                          \"EmployeeName\": lambda x:x.upper(),\n",
    "                          \"BasePay\": \"${:20,.0f}\", \n",
    "                          \"OtherPay\": \"${:20,.0f}\", \n",
    "                          \"TotalPay\": \"${:20,.0f}\",\n",
    "                          \"TotalPayBenefits\":\"${:20,.0f}\"})\\\n",
    "                  .hide(axis='index')\\\n",
    "                  .background_gradient(cmap='Reds')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style type=\"text/css\">\n",
       "#T_74cb3_row0_col0, #T_74cb3_row0_col1, #T_74cb3_row0_col2, #T_74cb3_row0_col3, #T_74cb3_row0_col4, #T_74cb3_row0_col5, #T_74cb3_row1_col0, #T_74cb3_row1_col1, #T_74cb3_row1_col2, #T_74cb3_row1_col3, #T_74cb3_row1_col4, #T_74cb3_row1_col5, #T_74cb3_row2_col0, #T_74cb3_row2_col1, #T_74cb3_row2_col2, #T_74cb3_row2_col3, #T_74cb3_row2_col4, #T_74cb3_row2_col5 {\n",
       "  background-color: black;\n",
       "  color: #00d6b9;\n",
       "  border-color: white;\n",
       "}\n",
       "</style>\n",
       "<table id=\"T_74cb3\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th id=\"T_74cb3_level0_col0\" class=\"col_heading level0 col0\" >BasePay</th>\n",
       "      <th id=\"T_74cb3_level0_col1\" class=\"col_heading level0 col1\" >OtherPay</th>\n",
       "      <th id=\"T_74cb3_level0_col2\" class=\"col_heading level0 col2\" >TotalPay</th>\n",
       "      <th id=\"T_74cb3_level0_col3\" class=\"col_heading level0 col3\" >TotalPayBenefits</th>\n",
       "      <th id=\"T_74cb3_level0_col4\" class=\"col_heading level0 col4\" >JobTitle</th>\n",
       "      <th id=\"T_74cb3_level0_col5\" class=\"col_heading level0 col5\" >EmployeeName</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td id=\"T_74cb3_row0_col0\" class=\"data row0 col0\" >$             167,411</td>\n",
       "      <td id=\"T_74cb3_row0_col1\" class=\"data row0 col1\" >$             400,184</td>\n",
       "      <td id=\"T_74cb3_row0_col2\" class=\"data row0 col2\" >$             567,595</td>\n",
       "      <td id=\"T_74cb3_row0_col3\" class=\"data row0 col3\" >$             567,595</td>\n",
       "      <td id=\"T_74cb3_row0_col4\" class=\"data row0 col4\" >general manager-metropolitan transit authority</td>\n",
       "      <td id=\"T_74cb3_row0_col5\" class=\"data row0 col5\" >NATHANIEL FORD</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_74cb3_row1_col0\" class=\"data row1 col0\" >$             155,966</td>\n",
       "      <td id=\"T_74cb3_row1_col1\" class=\"data row1 col1\" >$             137,811</td>\n",
       "      <td id=\"T_74cb3_row1_col2\" class=\"data row1 col2\" >$             538,909</td>\n",
       "      <td id=\"T_74cb3_row1_col3\" class=\"data row1 col3\" >$             538,909</td>\n",
       "      <td id=\"T_74cb3_row1_col4\" class=\"data row1 col4\" >captain iii (police department)</td>\n",
       "      <td id=\"T_74cb3_row1_col5\" class=\"data row1 col5\" >GARY JIMENEZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_74cb3_row2_col0\" class=\"data row2 col0\" >$             212,739</td>\n",
       "      <td id=\"T_74cb3_row2_col1\" class=\"data row2 col1\" >$              16,453</td>\n",
       "      <td id=\"T_74cb3_row2_col2\" class=\"data row2 col2\" >$             335,280</td>\n",
       "      <td id=\"T_74cb3_row2_col3\" class=\"data row2 col3\" >$             335,280</td>\n",
       "      <td id=\"T_74cb3_row2_col4\" class=\"data row2 col4\" >captain iii (police department)</td>\n",
       "      <td id=\"T_74cb3_row2_col5\" class=\"data row2 col5\" >ALBERT PARDINI</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x21a3506b8b0>"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head(3)[[\"BasePay\",\"OtherPay\",\"TotalPay\",\"TotalPayBenefits\",\"JobTitle\",\"EmployeeName\"]]\\\n",
    "            .style.format({\"JobTitle\": lambda x:x.lower(),\n",
    "                          \"EmployeeName\": lambda x:x.upper(),\n",
    "                          \"BasePay\": \"${:20,.0f}\", \n",
    "                          \"OtherPay\": \"${:20,.0f}\", \n",
    "                          \"TotalPay\": \"${:20,.0f}\",\n",
    "                          \"TotalPayBenefits\":\"${:20,.0f}\"})\\\n",
    "                  .hide(axis='index')\\\n",
    "                  .set_properties(**{'background-color': 'black',                                                   \n",
    "                                    'color': '#00d6b9',                       \n",
    "                                    'border-color': 'white'})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style type=\"text/css\">\n",
       "#T_58d0e_row0_col0, #T_58d0e_row0_col1, #T_58d0e_row0_col2, #T_58d0e_row0_col3, #T_58d0e_row1_col0, #T_58d0e_row1_col1, #T_58d0e_row1_col2, #T_58d0e_row1_col3, #T_58d0e_row2_col0, #T_58d0e_row2_col1, #T_58d0e_row2_col2, #T_58d0e_row2_col3 {\n",
       "  color: #e04da2;\n",
       "}\n",
       "#T_58d0e_row0_col4, #T_58d0e_row1_col4, #T_58d0e_row1_col5, #T_58d0e_row2_col4, #T_58d0e_row2_col5 {\n",
       "  color: #3773ff;\n",
       "}\n",
       "#T_58d0e_row0_col5 {\n",
       "  color: red;\n",
       "}\n",
       "</style>\n",
       "<table id=\"T_58d0e\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th id=\"T_58d0e_level0_col0\" class=\"col_heading level0 col0\" >BasePay</th>\n",
       "      <th id=\"T_58d0e_level0_col1\" class=\"col_heading level0 col1\" >OtherPay</th>\n",
       "      <th id=\"T_58d0e_level0_col2\" class=\"col_heading level0 col2\" >TotalPay</th>\n",
       "      <th id=\"T_58d0e_level0_col3\" class=\"col_heading level0 col3\" >TotalPayBenefits</th>\n",
       "      <th id=\"T_58d0e_level0_col4\" class=\"col_heading level0 col4\" >JobTitle</th>\n",
       "      <th id=\"T_58d0e_level0_col5\" class=\"col_heading level0 col5\" >EmployeeName</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td id=\"T_58d0e_row0_col0\" class=\"data row0 col0\" >$             167,411</td>\n",
       "      <td id=\"T_58d0e_row0_col1\" class=\"data row0 col1\" >$             400,184</td>\n",
       "      <td id=\"T_58d0e_row0_col2\" class=\"data row0 col2\" >$             567,595</td>\n",
       "      <td id=\"T_58d0e_row0_col3\" class=\"data row0 col3\" >$             567,595</td>\n",
       "      <td id=\"T_58d0e_row0_col4\" class=\"data row0 col4\" >general manager-metropolitan transit authority</td>\n",
       "      <td id=\"T_58d0e_row0_col5\" class=\"data row0 col5\" >NATHANIEL FORD</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_58d0e_row1_col0\" class=\"data row1 col0\" >$             155,966</td>\n",
       "      <td id=\"T_58d0e_row1_col1\" class=\"data row1 col1\" >$             137,811</td>\n",
       "      <td id=\"T_58d0e_row1_col2\" class=\"data row1 col2\" >$             538,909</td>\n",
       "      <td id=\"T_58d0e_row1_col3\" class=\"data row1 col3\" >$             538,909</td>\n",
       "      <td id=\"T_58d0e_row1_col4\" class=\"data row1 col4\" >captain iii (police department)</td>\n",
       "      <td id=\"T_58d0e_row1_col5\" class=\"data row1 col5\" >GARY JIMENEZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_58d0e_row2_col0\" class=\"data row2 col0\" >$             212,739</td>\n",
       "      <td id=\"T_58d0e_row2_col1\" class=\"data row2 col1\" >$              16,453</td>\n",
       "      <td id=\"T_58d0e_row2_col2\" class=\"data row2 col2\" >$             335,280</td>\n",
       "      <td id=\"T_58d0e_row2_col3\" class=\"data row2 col3\" >$             335,280</td>\n",
       "      <td id=\"T_58d0e_row2_col4\" class=\"data row2 col4\" >captain iii (police department)</td>\n",
       "      <td id=\"T_58d0e_row2_col5\" class=\"data row2 col5\" >ALBERT PARDINI</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x21a2b34ab80>"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head(3)[[\"BasePay\",\"OtherPay\",\"TotalPay\",\"TotalPayBenefits\",\"JobTitle\",\"EmployeeName\"]]\\\n",
    "            .style.format({\"JobTitle\": lambda x:x.lower(),\n",
    "                          \"EmployeeName\": lambda x:x.upper(),\n",
    "                          \"BasePay\": \"${:20,.0f}\", \n",
    "                          \"OtherPay\": \"${:20,.0f}\", \n",
    "                          \"TotalPay\": \"${:20,.0f}\",\n",
    "                          \"TotalPayBenefits\":\"${:20,.0f}\"})\\\n",
    "                  .hide(axis='index')\\\n",
    "                  .applymap(lambda x: f\"color: {'#e04da2' if isinstance(x,float) else('red' if str(x).startswith('D') or str(x).endswith('D') else '#3773ff')}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style type=\"text/css\">\n",
       "#T_3570a_row0_col0 {\n",
       "  color: #e04da2;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #f7c9c5 78.7%, transparent 78.7%);\n",
       "}\n",
       "#T_3570a_row0_col1 {\n",
       "  color: #e04da2;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #90ee90 100.0%, transparent 100.0%);\n",
       "}\n",
       "#T_3570a_row0_col2 {\n",
       "  color: #e04da2;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #b5cdff 100.0%, transparent 100.0%);\n",
       "}\n",
       "#T_3570a_row0_col3, #T_3570a_row1_col3, #T_3570a_row2_col3 {\n",
       "  color: #e04da2;\n",
       "}\n",
       "#T_3570a_row0_col4, #T_3570a_row1_col4, #T_3570a_row1_col5, #T_3570a_row2_col4, #T_3570a_row2_col5 {\n",
       "  color: #3773ff;\n",
       "}\n",
       "#T_3570a_row0_col5 {\n",
       "  color: red;\n",
       "}\n",
       "#T_3570a_row1_col0 {\n",
       "  color: #e04da2;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #f7c9c5 73.3%, transparent 73.3%);\n",
       "}\n",
       "#T_3570a_row1_col1 {\n",
       "  color: #e04da2;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #90ee90 34.4%, transparent 34.4%);\n",
       "}\n",
       "#T_3570a_row1_col2 {\n",
       "  color: #e04da2;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #b5cdff 94.9%, transparent 94.9%);\n",
       "}\n",
       "#T_3570a_row2_col0 {\n",
       "  color: #e04da2;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #f7c9c5 100.0%, transparent 100.0%);\n",
       "}\n",
       "#T_3570a_row2_col1 {\n",
       "  color: #e04da2;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #90ee90 4.1%, transparent 4.1%);\n",
       "}\n",
       "#T_3570a_row2_col2 {\n",
       "  color: #e04da2;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #b5cdff 59.1%, transparent 59.1%);\n",
       "}\n",
       "</style>\n",
       "<table id=\"T_3570a\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th id=\"T_3570a_level0_col0\" class=\"col_heading level0 col0\" >BasePay</th>\n",
       "      <th id=\"T_3570a_level0_col1\" class=\"col_heading level0 col1\" >OtherPay</th>\n",
       "      <th id=\"T_3570a_level0_col2\" class=\"col_heading level0 col2\" >TotalPay</th>\n",
       "      <th id=\"T_3570a_level0_col3\" class=\"col_heading level0 col3\" >TotalPayBenefits</th>\n",
       "      <th id=\"T_3570a_level0_col4\" class=\"col_heading level0 col4\" >JobTitle</th>\n",
       "      <th id=\"T_3570a_level0_col5\" class=\"col_heading level0 col5\" >EmployeeName</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td id=\"T_3570a_row0_col0\" class=\"data row0 col0\" >$             167,411</td>\n",
       "      <td id=\"T_3570a_row0_col1\" class=\"data row0 col1\" >$             400,184</td>\n",
       "      <td id=\"T_3570a_row0_col2\" class=\"data row0 col2\" >$             567,595</td>\n",
       "      <td id=\"T_3570a_row0_col3\" class=\"data row0 col3\" >$             567,595</td>\n",
       "      <td id=\"T_3570a_row0_col4\" class=\"data row0 col4\" >general manager-metropolitan transit authority</td>\n",
       "      <td id=\"T_3570a_row0_col5\" class=\"data row0 col5\" >NATHANIEL FORD</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_3570a_row1_col0\" class=\"data row1 col0\" >$             155,966</td>\n",
       "      <td id=\"T_3570a_row1_col1\" class=\"data row1 col1\" >$             137,811</td>\n",
       "      <td id=\"T_3570a_row1_col2\" class=\"data row1 col2\" >$             538,909</td>\n",
       "      <td id=\"T_3570a_row1_col3\" class=\"data row1 col3\" >$             538,909</td>\n",
       "      <td id=\"T_3570a_row1_col4\" class=\"data row1 col4\" >captain iii (police department)</td>\n",
       "      <td id=\"T_3570a_row1_col5\" class=\"data row1 col5\" >GARY JIMENEZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_3570a_row2_col0\" class=\"data row2 col0\" >$             212,739</td>\n",
       "      <td id=\"T_3570a_row2_col1\" class=\"data row2 col1\" >$              16,453</td>\n",
       "      <td id=\"T_3570a_row2_col2\" class=\"data row2 col2\" >$             335,280</td>\n",
       "      <td id=\"T_3570a_row2_col3\" class=\"data row2 col3\" >$             335,280</td>\n",
       "      <td id=\"T_3570a_row2_col4\" class=\"data row2 col4\" >captain iii (police department)</td>\n",
       "      <td id=\"T_3570a_row2_col5\" class=\"data row2 col5\" >ALBERT PARDINI</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x21a2b3d7dc0>"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head(3)[[\"BasePay\",\"OtherPay\",\"TotalPay\",\"TotalPayBenefits\",\"JobTitle\",\"EmployeeName\"]]\\\n",
    "            .style.format({\"JobTitle\": lambda x:x.lower(),\n",
    "                          \"EmployeeName\": lambda x:x.upper(),\n",
    "                          \"BasePay\": \"${:20,.0f}\", \n",
    "                          \"OtherPay\": \"${:20,.0f}\", \n",
    "                          \"TotalPay\": \"${:20,.0f}\",\n",
    "                          \"TotalPayBenefits\":\"${:20,.0f}\"})\\\n",
    "                  .hide(axis='index')\\\n",
    "                  .applymap(lambda x: f\"color: {'#e04da2' if isinstance(x,float) else('red' if str(x).startswith('D') or str(x).endswith('D') else '#3773ff')}\")\\\n",
    "                  .bar(subset=[\"OtherPay\"], color='#90ee90')\\\n",
    "                  .bar(subset=[\"BasePay\"], color='#f7c9c5')\\\n",
    "                  .bar(subset=[\"TotalPay\"], color='#b5cdff')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style type=\"text/css\">\n",
       "#T_4af66_row0_col0 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #0086ff 58.7%, transparent 58.7%);\n",
       "}\n",
       "#T_4af66_row0_col1, #T_4af66_row0_col2, #T_4af66_row9_col0 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #ff0018 100.0%, transparent 100.0%);\n",
       "}\n",
       "#T_4af66_row0_col3, #T_4af66_row1_col3, #T_4af66_row2_col3, #T_4af66_row3_col3, #T_4af66_row4_col3, #T_4af66_row5_col3, #T_4af66_row6_col3, #T_4af66_row7_col3, #T_4af66_row8_col3, #T_4af66_row9_col3 {\n",
       "  color: black;\n",
       "}\n",
       "#T_4af66_row0_col4, #T_4af66_row1_col4, #T_4af66_row1_col5, #T_4af66_row2_col4, #T_4af66_row2_col5, #T_4af66_row3_col4, #T_4af66_row3_col5, #T_4af66_row4_col5, #T_4af66_row5_col4, #T_4af66_row6_col4, #T_4af66_row6_col5, #T_4af66_row8_col4, #T_4af66_row8_col5, #T_4af66_row9_col4, #T_4af66_row9_col5 {\n",
       "  color: #3773ff;\n",
       "}\n",
       "#T_4af66_row0_col5, #T_4af66_row4_col4, #T_4af66_row5_col5, #T_4af66_row7_col4, #T_4af66_row7_col5 {\n",
       "  color: red;\n",
       "}\n",
       "#T_4af66_row1_col0 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #00c7ff 54.7%, transparent 54.7%);\n",
       "}\n",
       "#T_4af66_row1_col1 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #02ff0c 34.4%, transparent 34.4%);\n",
       "}\n",
       "#T_4af66_row1_col2 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #ff005f 94.9%, transparent 94.9%);\n",
       "}\n",
       "#T_4af66_row2_col0 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #6600ff 74.6%, transparent 74.6%);\n",
       "}\n",
       "#T_4af66_row2_col1 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #ff3b00 4.1%, transparent 4.1%);\n",
       "}\n",
       "#T_4af66_row2_col2 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #0080ff 59.1%, transparent 59.1%);\n",
       "}\n",
       "#T_4af66_row3_col0 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #66ff00 27.3%, transparent 27.3%);\n",
       "}\n",
       "#T_4af66_row3_col1 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #00ffea 49.6%, transparent 49.6%);\n",
       "}\n",
       "#T_4af66_row3_col2 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #008cff 58.6%, transparent 58.6%);\n",
       "}\n",
       "#T_4af66_row4_col0 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #00ffc7 47.1%, transparent 47.1%);\n",
       "}\n",
       "#T_4af66_row4_col1 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #00ffaf 45.5%, transparent 45.5%);\n",
       "}\n",
       "#T_4af66_row4_col2 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #0098ff 57.5%, transparent 57.5%);\n",
       "}\n",
       "#T_4af66_row5_col0 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #00ff74 41.6%, transparent 41.6%);\n",
       "}\n",
       "#T_4af66_row5_col1 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #00ffc7 47.2%, transparent 47.2%);\n",
       "}\n",
       "#T_4af66_row5_col2, #T_4af66_row6_col2 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #00b5ff 55.7%, transparent 55.7%);\n",
       "}\n",
       "#T_4af66_row6_col0 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #14ff00 32.4%, transparent 32.4%);\n",
       "}\n",
       "#T_4af66_row6_col1 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #08ff00 33.6%, transparent 33.6%);\n",
       "}\n",
       "#T_4af66_row7_col0 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #ff00ac 89.9%, transparent 89.9%);\n",
       "}\n",
       "#T_4af66_row7_col1 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #ffbd00 12.8%, transparent 12.8%);\n",
       "}\n",
       "#T_4af66_row7_col2 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #00cdff 54.2%, transparent 54.2%);\n",
       "}\n",
       "#T_4af66_row8_col0 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #0057ff 62.0%, transparent 62.0%);\n",
       "}\n",
       "#T_4af66_row8_col1 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #ff9400 10.0%, transparent 10.0%);\n",
       "}\n",
       "#T_4af66_row8_col2 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #00d9ff 53.5%, transparent 53.5%);\n",
       "}\n",
       "#T_4af66_row9_col1 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #ff3b00 4.3%, transparent 4.3%);\n",
       "}\n",
       "#T_4af66_row9_col2 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #00d9ff 53.3%, transparent 53.3%);\n",
       "}\n",
       "</style>\n",
       "<table id=\"T_4af66\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th id=\"T_4af66_level0_col0\" class=\"col_heading level0 col0\" >BasePay</th>\n",
       "      <th id=\"T_4af66_level0_col1\" class=\"col_heading level0 col1\" >OtherPay</th>\n",
       "      <th id=\"T_4af66_level0_col2\" class=\"col_heading level0 col2\" >TotalPay</th>\n",
       "      <th id=\"T_4af66_level0_col3\" class=\"col_heading level0 col3\" >TotalPayBenefits</th>\n",
       "      <th id=\"T_4af66_level0_col4\" class=\"col_heading level0 col4\" >JobTitle</th>\n",
       "      <th id=\"T_4af66_level0_col5\" class=\"col_heading level0 col5\" >EmployeeName</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td id=\"T_4af66_row0_col0\" class=\"data row0 col0\" >$             167,411</td>\n",
       "      <td id=\"T_4af66_row0_col1\" class=\"data row0 col1\" >$             400,184</td>\n",
       "      <td id=\"T_4af66_row0_col2\" class=\"data row0 col2\" >$             567,595</td>\n",
       "      <td id=\"T_4af66_row0_col3\" class=\"data row0 col3\" >$             567,595</td>\n",
       "      <td id=\"T_4af66_row0_col4\" class=\"data row0 col4\" >general manager-metropolitan transit authority</td>\n",
       "      <td id=\"T_4af66_row0_col5\" class=\"data row0 col5\" >NATHANIEL FORD</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_4af66_row1_col0\" class=\"data row1 col0\" >$             155,966</td>\n",
       "      <td id=\"T_4af66_row1_col1\" class=\"data row1 col1\" >$             137,811</td>\n",
       "      <td id=\"T_4af66_row1_col2\" class=\"data row1 col2\" >$             538,909</td>\n",
       "      <td id=\"T_4af66_row1_col3\" class=\"data row1 col3\" >$             538,909</td>\n",
       "      <td id=\"T_4af66_row1_col4\" class=\"data row1 col4\" >captain iii (police department)</td>\n",
       "      <td id=\"T_4af66_row1_col5\" class=\"data row1 col5\" >GARY JIMENEZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_4af66_row2_col0\" class=\"data row2 col0\" >$             212,739</td>\n",
       "      <td id=\"T_4af66_row2_col1\" class=\"data row2 col1\" >$              16,453</td>\n",
       "      <td id=\"T_4af66_row2_col2\" class=\"data row2 col2\" >$             335,280</td>\n",
       "      <td id=\"T_4af66_row2_col3\" class=\"data row2 col3\" >$             335,280</td>\n",
       "      <td id=\"T_4af66_row2_col4\" class=\"data row2 col4\" >captain iii (police department)</td>\n",
       "      <td id=\"T_4af66_row2_col5\" class=\"data row2 col5\" >ALBERT PARDINI</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_4af66_row3_col0\" class=\"data row3 col0\" >$              77,916</td>\n",
       "      <td id=\"T_4af66_row3_col1\" class=\"data row3 col1\" >$             198,307</td>\n",
       "      <td id=\"T_4af66_row3_col2\" class=\"data row3 col2\" >$             332,344</td>\n",
       "      <td id=\"T_4af66_row3_col3\" class=\"data row3 col3\" >$             332,344</td>\n",
       "      <td id=\"T_4af66_row3_col4\" class=\"data row3 col4\" >wire rope cable maintenance mechanic</td>\n",
       "      <td id=\"T_4af66_row3_col5\" class=\"data row3 col5\" >CHRISTOPHER CHONG</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_4af66_row4_col0\" class=\"data row4 col0\" >$             134,402</td>\n",
       "      <td id=\"T_4af66_row4_col1\" class=\"data row4 col1\" >$             182,235</td>\n",
       "      <td id=\"T_4af66_row4_col2\" class=\"data row4 col2\" >$             326,373</td>\n",
       "      <td id=\"T_4af66_row4_col3\" class=\"data row4 col3\" >$             326,373</td>\n",
       "      <td id=\"T_4af66_row4_col4\" class=\"data row4 col4\" >deputy chief of department,(fire department)</td>\n",
       "      <td id=\"T_4af66_row4_col5\" class=\"data row4 col5\" >PATRICK GARDNER</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_4af66_row5_col0\" class=\"data row5 col0\" >$             118,602</td>\n",
       "      <td id=\"T_4af66_row5_col1\" class=\"data row5 col1\" >$             189,083</td>\n",
       "      <td id=\"T_4af66_row5_col2\" class=\"data row5 col2\" >$             316,286</td>\n",
       "      <td id=\"T_4af66_row5_col3\" class=\"data row5 col3\" >$             316,286</td>\n",
       "      <td id=\"T_4af66_row5_col4\" class=\"data row5 col4\" >assistant deputy chief ii</td>\n",
       "      <td id=\"T_4af66_row5_col5\" class=\"data row5 col5\" >DAVID SULLIVAN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_4af66_row6_col0\" class=\"data row6 col0\" >$              92,492</td>\n",
       "      <td id=\"T_4af66_row6_col1\" class=\"data row6 col1\" >$             134,426</td>\n",
       "      <td id=\"T_4af66_row6_col2\" class=\"data row6 col2\" >$             315,981</td>\n",
       "      <td id=\"T_4af66_row6_col3\" class=\"data row6 col3\" >$             315,981</td>\n",
       "      <td id=\"T_4af66_row6_col4\" class=\"data row6 col4\" >battalion chief, (fire department)</td>\n",
       "      <td id=\"T_4af66_row6_col5\" class=\"data row6 col5\" >ALSON LEE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_4af66_row7_col0\" class=\"data row7 col0\" >$             256,577</td>\n",
       "      <td id=\"T_4af66_row7_col1\" class=\"data row7 col1\" >$              51,322</td>\n",
       "      <td id=\"T_4af66_row7_col2\" class=\"data row7 col2\" >$             307,899</td>\n",
       "      <td id=\"T_4af66_row7_col3\" class=\"data row7 col3\" >$             307,899</td>\n",
       "      <td id=\"T_4af66_row7_col4\" class=\"data row7 col4\" >deputy director of investments</td>\n",
       "      <td id=\"T_4af66_row7_col5\" class=\"data row7 col5\" >DAVID KUSHNER</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_4af66_row8_col0\" class=\"data row8 col0\" >$             176,933</td>\n",
       "      <td id=\"T_4af66_row8_col1\" class=\"data row8 col1\" >$              40,132</td>\n",
       "      <td id=\"T_4af66_row8_col2\" class=\"data row8 col2\" >$             303,428</td>\n",
       "      <td id=\"T_4af66_row8_col3\" class=\"data row8 col3\" >$             303,428</td>\n",
       "      <td id=\"T_4af66_row8_col4\" class=\"data row8 col4\" >battalion chief, (fire department)</td>\n",
       "      <td id=\"T_4af66_row8_col5\" class=\"data row8 col5\" >MICHAEL MORRIS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td id=\"T_4af66_row9_col0\" class=\"data row9 col0\" >$             285,262</td>\n",
       "      <td id=\"T_4af66_row9_col1\" class=\"data row9 col1\" >$              17,116</td>\n",
       "      <td id=\"T_4af66_row9_col2\" class=\"data row9 col2\" >$             302,378</td>\n",
       "      <td id=\"T_4af66_row9_col3\" class=\"data row9 col3\" >$             302,378</td>\n",
       "      <td id=\"T_4af66_row9_col4\" class=\"data row9 col4\" >chief of department, (fire department)</td>\n",
       "      <td id=\"T_4af66_row9_col5\" class=\"data row9 col5\" >JOANNE HAYES-WHITE</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x21a2c2f7190>"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head(10)[[\"BasePay\",\"OtherPay\",\"TotalPay\",\"TotalPayBenefits\",\"JobTitle\",\"EmployeeName\"]]\\\n",
    "            .style.format({\"JobTitle\": lambda x:x.lower(),\n",
    "                          \"EmployeeName\": lambda x:x.upper(),\n",
    "                          \"BasePay\": \"${:20,.0f}\", \n",
    "                          \"OtherPay\": \"${:20,.0f}\", \n",
    "                          \"TotalPay\": \"${:20,.0f}\",\n",
    "                          \"TotalPayBenefits\":\"${:20,.0f}\"})\\\n",
    "                  .hide(axis='index')\\\n",
    "                  .applymap(lambda x: f\"color: {'black' if isinstance(x,float) else('red' if str(x).startswith('D') or str(x).endswith('D') else '#3773ff')}\")\\\n",
    "                  .bar(subset=[\"OtherPay\",\"BasePay\",\"TotalPay\"], cmap='hsv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style type=\"text/css\">\n",
       "#T_46d9b_level0_row0, #T_46d9b_level0_row2, #T_46d9b_level0_row4, #T_46d9b_level0_row6, #T_46d9b_level0_row8 {\n",
       "  background-color: #28d6ff;\n",
       "}\n",
       "#T_46d9b_level0_row1, #T_46d9b_level0_row3, #T_46d9b_level0_row5, #T_46d9b_level0_row7, #T_46d9b_level0_row9 {\n",
       "  background-color: #bd56fd;\n",
       "}\n",
       "</style>\n",
       "<table id=\"T_46d9b\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th class=\"blank level0\" >&nbsp;</th>\n",
       "      <th id=\"T_46d9b_level0_col0\" class=\"col_heading level0 col0\" >BasePay</th>\n",
       "      <th id=\"T_46d9b_level0_col1\" class=\"col_heading level0 col1\" >OtherPay</th>\n",
       "      <th id=\"T_46d9b_level0_col2\" class=\"col_heading level0 col2\" >TotalPay</th>\n",
       "      <th id=\"T_46d9b_level0_col3\" class=\"col_heading level0 col3\" >TotalPayBenefits</th>\n",
       "      <th id=\"T_46d9b_level0_col4\" class=\"col_heading level0 col4\" >JobTitle</th>\n",
       "      <th id=\"T_46d9b_level0_col5\" class=\"col_heading level0 col5\" >EmployeeName</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th id=\"T_46d9b_level0_row0\" class=\"row_heading level0 row0\" >0</th>\n",
       "      <td id=\"T_46d9b_row0_col0\" class=\"data row0 col0\" >$             167,411</td>\n",
       "      <td id=\"T_46d9b_row0_col1\" class=\"data row0 col1\" >$             400,184</td>\n",
       "      <td id=\"T_46d9b_row0_col2\" class=\"data row0 col2\" >$             567,595</td>\n",
       "      <td id=\"T_46d9b_row0_col3\" class=\"data row0 col3\" >$             567,595</td>\n",
       "      <td id=\"T_46d9b_row0_col4\" class=\"data row0 col4\" >general manager-metropolitan transit authority</td>\n",
       "      <td id=\"T_46d9b_row0_col5\" class=\"data row0 col5\" >NATHANIEL FORD</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_46d9b_level0_row1\" class=\"row_heading level0 row1\" >1</th>\n",
       "      <td id=\"T_46d9b_row1_col0\" class=\"data row1 col0\" >$             155,966</td>\n",
       "      <td id=\"T_46d9b_row1_col1\" class=\"data row1 col1\" >$             137,811</td>\n",
       "      <td id=\"T_46d9b_row1_col2\" class=\"data row1 col2\" >$             538,909</td>\n",
       "      <td id=\"T_46d9b_row1_col3\" class=\"data row1 col3\" >$             538,909</td>\n",
       "      <td id=\"T_46d9b_row1_col4\" class=\"data row1 col4\" >captain iii (police department)</td>\n",
       "      <td id=\"T_46d9b_row1_col5\" class=\"data row1 col5\" >GARY JIMENEZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_46d9b_level0_row2\" class=\"row_heading level0 row2\" >2</th>\n",
       "      <td id=\"T_46d9b_row2_col0\" class=\"data row2 col0\" >$             212,739</td>\n",
       "      <td id=\"T_46d9b_row2_col1\" class=\"data row2 col1\" >$              16,453</td>\n",
       "      <td id=\"T_46d9b_row2_col2\" class=\"data row2 col2\" >$             335,280</td>\n",
       "      <td id=\"T_46d9b_row2_col3\" class=\"data row2 col3\" >$             335,280</td>\n",
       "      <td id=\"T_46d9b_row2_col4\" class=\"data row2 col4\" >captain iii (police department)</td>\n",
       "      <td id=\"T_46d9b_row2_col5\" class=\"data row2 col5\" >ALBERT PARDINI</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_46d9b_level0_row3\" class=\"row_heading level0 row3\" >3</th>\n",
       "      <td id=\"T_46d9b_row3_col0\" class=\"data row3 col0\" >$              77,916</td>\n",
       "      <td id=\"T_46d9b_row3_col1\" class=\"data row3 col1\" >$             198,307</td>\n",
       "      <td id=\"T_46d9b_row3_col2\" class=\"data row3 col2\" >$             332,344</td>\n",
       "      <td id=\"T_46d9b_row3_col3\" class=\"data row3 col3\" >$             332,344</td>\n",
       "      <td id=\"T_46d9b_row3_col4\" class=\"data row3 col4\" >wire rope cable maintenance mechanic</td>\n",
       "      <td id=\"T_46d9b_row3_col5\" class=\"data row3 col5\" >CHRISTOPHER CHONG</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_46d9b_level0_row4\" class=\"row_heading level0 row4\" >4</th>\n",
       "      <td id=\"T_46d9b_row4_col0\" class=\"data row4 col0\" >$             134,402</td>\n",
       "      <td id=\"T_46d9b_row4_col1\" class=\"data row4 col1\" >$             182,235</td>\n",
       "      <td id=\"T_46d9b_row4_col2\" class=\"data row4 col2\" >$             326,373</td>\n",
       "      <td id=\"T_46d9b_row4_col3\" class=\"data row4 col3\" >$             326,373</td>\n",
       "      <td id=\"T_46d9b_row4_col4\" class=\"data row4 col4\" >deputy chief of department,(fire department)</td>\n",
       "      <td id=\"T_46d9b_row4_col5\" class=\"data row4 col5\" >PATRICK GARDNER</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_46d9b_level0_row5\" class=\"row_heading level0 row5\" >5</th>\n",
       "      <td id=\"T_46d9b_row5_col0\" class=\"data row5 col0\" >$             118,602</td>\n",
       "      <td id=\"T_46d9b_row5_col1\" class=\"data row5 col1\" >$             189,083</td>\n",
       "      <td id=\"T_46d9b_row5_col2\" class=\"data row5 col2\" >$             316,286</td>\n",
       "      <td id=\"T_46d9b_row5_col3\" class=\"data row5 col3\" >$             316,286</td>\n",
       "      <td id=\"T_46d9b_row5_col4\" class=\"data row5 col4\" >assistant deputy chief ii</td>\n",
       "      <td id=\"T_46d9b_row5_col5\" class=\"data row5 col5\" >DAVID SULLIVAN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_46d9b_level0_row6\" class=\"row_heading level0 row6\" >6</th>\n",
       "      <td id=\"T_46d9b_row6_col0\" class=\"data row6 col0\" >$              92,492</td>\n",
       "      <td id=\"T_46d9b_row6_col1\" class=\"data row6 col1\" >$             134,426</td>\n",
       "      <td id=\"T_46d9b_row6_col2\" class=\"data row6 col2\" >$             315,981</td>\n",
       "      <td id=\"T_46d9b_row6_col3\" class=\"data row6 col3\" >$             315,981</td>\n",
       "      <td id=\"T_46d9b_row6_col4\" class=\"data row6 col4\" >battalion chief, (fire department)</td>\n",
       "      <td id=\"T_46d9b_row6_col5\" class=\"data row6 col5\" >ALSON LEE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_46d9b_level0_row7\" class=\"row_heading level0 row7\" >7</th>\n",
       "      <td id=\"T_46d9b_row7_col0\" class=\"data row7 col0\" >$             256,577</td>\n",
       "      <td id=\"T_46d9b_row7_col1\" class=\"data row7 col1\" >$              51,322</td>\n",
       "      <td id=\"T_46d9b_row7_col2\" class=\"data row7 col2\" >$             307,899</td>\n",
       "      <td id=\"T_46d9b_row7_col3\" class=\"data row7 col3\" >$             307,899</td>\n",
       "      <td id=\"T_46d9b_row7_col4\" class=\"data row7 col4\" >deputy director of investments</td>\n",
       "      <td id=\"T_46d9b_row7_col5\" class=\"data row7 col5\" >DAVID KUSHNER</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_46d9b_level0_row8\" class=\"row_heading level0 row8\" >8</th>\n",
       "      <td id=\"T_46d9b_row8_col0\" class=\"data row8 col0\" >$             176,933</td>\n",
       "      <td id=\"T_46d9b_row8_col1\" class=\"data row8 col1\" >$              40,132</td>\n",
       "      <td id=\"T_46d9b_row8_col2\" class=\"data row8 col2\" >$             303,428</td>\n",
       "      <td id=\"T_46d9b_row8_col3\" class=\"data row8 col3\" >$             303,428</td>\n",
       "      <td id=\"T_46d9b_row8_col4\" class=\"data row8 col4\" >battalion chief, (fire department)</td>\n",
       "      <td id=\"T_46d9b_row8_col5\" class=\"data row8 col5\" >MICHAEL MORRIS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_46d9b_level0_row9\" class=\"row_heading level0 row9\" >9</th>\n",
       "      <td id=\"T_46d9b_row9_col0\" class=\"data row9 col0\" >$             285,262</td>\n",
       "      <td id=\"T_46d9b_row9_col1\" class=\"data row9 col1\" >$              17,116</td>\n",
       "      <td id=\"T_46d9b_row9_col2\" class=\"data row9 col2\" >$             302,378</td>\n",
       "      <td id=\"T_46d9b_row9_col3\" class=\"data row9 col3\" >$             302,378</td>\n",
       "      <td id=\"T_46d9b_row9_col4\" class=\"data row9 col4\" >chief of department, (fire department)</td>\n",
       "      <td id=\"T_46d9b_row9_col5\" class=\"data row9 col5\" >JOANNE HAYES-WHITE</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x21a30eee040>"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head(10)[[\"BasePay\",\"OtherPay\",\"TotalPay\",\"TotalPayBenefits\",\"JobTitle\",\"EmployeeName\"]]\\\n",
    "            .style.format({\"JobTitle\": lambda x:x.lower(),\n",
    "                          \"EmployeeName\": lambda x:x.upper(),\n",
    "                          \"BasePay\": \"${:20,.0f}\", \n",
    "                          \"OtherPay\": \"${:20,.0f}\", \n",
    "                          \"TotalPay\": \"${:20,.0f}\",\n",
    "                          \"TotalPayBenefits\":\"${:20,.0f}\"})\\\n",
    "                  .apply_index(lambda x: np.where(x % 2 == 0, \"background-color: #28d6ff;\", \"background-color: #bd56fd\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style type=\"text/css\">\n",
       "#T_d7a87 tr:hover {\n",
       "  background-color: lightblue;\n",
       "  font-size: 1em;\n",
       "}\n",
       "#T_d7a87_level0_row0, #T_d7a87_level0_row2, #T_d7a87_level0_row4, #T_d7a87_level0_row6, #T_d7a87_level0_row8 {\n",
       "  background-color: #28d6ff;\n",
       "}\n",
       "#T_d7a87_level0_row1, #T_d7a87_level0_row3, #T_d7a87_level0_row5, #T_d7a87_level0_row7, #T_d7a87_level0_row9 {\n",
       "  background-color: #bd56fd;\n",
       "}\n",
       "#T_d7a87_level0_col0, #T_d7a87_level0_col1, #T_d7a87_level0_col4, #T_d7a87_level0_col5 {\n",
       "  background-color: #fed460;\n",
       "}\n",
       "#T_d7a87_level0_col2, #T_d7a87_level0_col3 {\n",
       "  background-color: #4fea79;\n",
       "}\n",
       "</style>\n",
       "<table id=\"T_d7a87\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th class=\"blank level0\" >&nbsp;</th>\n",
       "      <th id=\"T_d7a87_level0_col0\" class=\"col_heading level0 col0\" >BASEPAY</th>\n",
       "      <th id=\"T_d7a87_level0_col1\" class=\"col_heading level0 col1\" >OTHERPAY</th>\n",
       "      <th id=\"T_d7a87_level0_col2\" class=\"col_heading level0 col2\" >TOTALPAY</th>\n",
       "      <th id=\"T_d7a87_level0_col3\" class=\"col_heading level0 col3\" >TOTALPAYBENEFITS</th>\n",
       "      <th id=\"T_d7a87_level0_col4\" class=\"col_heading level0 col4\" >JOBTITLE</th>\n",
       "      <th id=\"T_d7a87_level0_col5\" class=\"col_heading level0 col5\" >EMPLOYEENAME</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th id=\"T_d7a87_level0_row0\" class=\"row_heading level0 row0\" >1</th>\n",
       "      <td id=\"T_d7a87_row0_col0\" class=\"data row0 col0\" >$             167,411</td>\n",
       "      <td id=\"T_d7a87_row0_col1\" class=\"data row0 col1\" >$             400,184</td>\n",
       "      <td id=\"T_d7a87_row0_col2\" class=\"data row0 col2\" >$             567,595</td>\n",
       "      <td id=\"T_d7a87_row0_col3\" class=\"data row0 col3\" >$             567,595</td>\n",
       "      <td id=\"T_d7a87_row0_col4\" class=\"data row0 col4\" >general manager-metropolitan transit authority</td>\n",
       "      <td id=\"T_d7a87_row0_col5\" class=\"data row0 col5\" >NATHANIEL FORD</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_d7a87_level0_row1\" class=\"row_heading level0 row1\" >2</th>\n",
       "      <td id=\"T_d7a87_row1_col0\" class=\"data row1 col0\" >$             155,966</td>\n",
       "      <td id=\"T_d7a87_row1_col1\" class=\"data row1 col1\" >$             137,811</td>\n",
       "      <td id=\"T_d7a87_row1_col2\" class=\"data row1 col2\" >$             538,909</td>\n",
       "      <td id=\"T_d7a87_row1_col3\" class=\"data row1 col3\" >$             538,909</td>\n",
       "      <td id=\"T_d7a87_row1_col4\" class=\"data row1 col4\" >captain iii (police department)</td>\n",
       "      <td id=\"T_d7a87_row1_col5\" class=\"data row1 col5\" >GARY JIMENEZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_d7a87_level0_row2\" class=\"row_heading level0 row2\" >3</th>\n",
       "      <td id=\"T_d7a87_row2_col0\" class=\"data row2 col0\" >$             212,739</td>\n",
       "      <td id=\"T_d7a87_row2_col1\" class=\"data row2 col1\" >$              16,453</td>\n",
       "      <td id=\"T_d7a87_row2_col2\" class=\"data row2 col2\" >$             335,280</td>\n",
       "      <td id=\"T_d7a87_row2_col3\" class=\"data row2 col3\" >$             335,280</td>\n",
       "      <td id=\"T_d7a87_row2_col4\" class=\"data row2 col4\" >captain iii (police department)</td>\n",
       "      <td id=\"T_d7a87_row2_col5\" class=\"data row2 col5\" >ALBERT PARDINI</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_d7a87_level0_row3\" class=\"row_heading level0 row3\" >4</th>\n",
       "      <td id=\"T_d7a87_row3_col0\" class=\"data row3 col0\" >$              77,916</td>\n",
       "      <td id=\"T_d7a87_row3_col1\" class=\"data row3 col1\" >$             198,307</td>\n",
       "      <td id=\"T_d7a87_row3_col2\" class=\"data row3 col2\" >$             332,344</td>\n",
       "      <td id=\"T_d7a87_row3_col3\" class=\"data row3 col3\" >$             332,344</td>\n",
       "      <td id=\"T_d7a87_row3_col4\" class=\"data row3 col4\" >wire rope cable maintenance mechanic</td>\n",
       "      <td id=\"T_d7a87_row3_col5\" class=\"data row3 col5\" >CHRISTOPHER CHONG</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_d7a87_level0_row4\" class=\"row_heading level0 row4\" >5</th>\n",
       "      <td id=\"T_d7a87_row4_col0\" class=\"data row4 col0\" >$             134,402</td>\n",
       "      <td id=\"T_d7a87_row4_col1\" class=\"data row4 col1\" >$             182,235</td>\n",
       "      <td id=\"T_d7a87_row4_col2\" class=\"data row4 col2\" >$             326,373</td>\n",
       "      <td id=\"T_d7a87_row4_col3\" class=\"data row4 col3\" >$             326,373</td>\n",
       "      <td id=\"T_d7a87_row4_col4\" class=\"data row4 col4\" >deputy chief of department,(fire department)</td>\n",
       "      <td id=\"T_d7a87_row4_col5\" class=\"data row4 col5\" >PATRICK GARDNER</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_d7a87_level0_row5\" class=\"row_heading level0 row5\" >6</th>\n",
       "      <td id=\"T_d7a87_row5_col0\" class=\"data row5 col0\" >$             118,602</td>\n",
       "      <td id=\"T_d7a87_row5_col1\" class=\"data row5 col1\" >$             189,083</td>\n",
       "      <td id=\"T_d7a87_row5_col2\" class=\"data row5 col2\" >$             316,286</td>\n",
       "      <td id=\"T_d7a87_row5_col3\" class=\"data row5 col3\" >$             316,286</td>\n",
       "      <td id=\"T_d7a87_row5_col4\" class=\"data row5 col4\" >assistant deputy chief ii</td>\n",
       "      <td id=\"T_d7a87_row5_col5\" class=\"data row5 col5\" >DAVID SULLIVAN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_d7a87_level0_row6\" class=\"row_heading level0 row6\" >7</th>\n",
       "      <td id=\"T_d7a87_row6_col0\" class=\"data row6 col0\" >$              92,492</td>\n",
       "      <td id=\"T_d7a87_row6_col1\" class=\"data row6 col1\" >$             134,426</td>\n",
       "      <td id=\"T_d7a87_row6_col2\" class=\"data row6 col2\" >$             315,981</td>\n",
       "      <td id=\"T_d7a87_row6_col3\" class=\"data row6 col3\" >$             315,981</td>\n",
       "      <td id=\"T_d7a87_row6_col4\" class=\"data row6 col4\" >battalion chief, (fire department)</td>\n",
       "      <td id=\"T_d7a87_row6_col5\" class=\"data row6 col5\" >ALSON LEE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_d7a87_level0_row7\" class=\"row_heading level0 row7\" >8</th>\n",
       "      <td id=\"T_d7a87_row7_col0\" class=\"data row7 col0\" >$             256,577</td>\n",
       "      <td id=\"T_d7a87_row7_col1\" class=\"data row7 col1\" >$              51,322</td>\n",
       "      <td id=\"T_d7a87_row7_col2\" class=\"data row7 col2\" >$             307,899</td>\n",
       "      <td id=\"T_d7a87_row7_col3\" class=\"data row7 col3\" >$             307,899</td>\n",
       "      <td id=\"T_d7a87_row7_col4\" class=\"data row7 col4\" >deputy director of investments</td>\n",
       "      <td id=\"T_d7a87_row7_col5\" class=\"data row7 col5\" >DAVID KUSHNER</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_d7a87_level0_row8\" class=\"row_heading level0 row8\" >9</th>\n",
       "      <td id=\"T_d7a87_row8_col0\" class=\"data row8 col0\" >$             176,933</td>\n",
       "      <td id=\"T_d7a87_row8_col1\" class=\"data row8 col1\" >$              40,132</td>\n",
       "      <td id=\"T_d7a87_row8_col2\" class=\"data row8 col2\" >$             303,428</td>\n",
       "      <td id=\"T_d7a87_row8_col3\" class=\"data row8 col3\" >$             303,428</td>\n",
       "      <td id=\"T_d7a87_row8_col4\" class=\"data row8 col4\" >battalion chief, (fire department)</td>\n",
       "      <td id=\"T_d7a87_row8_col5\" class=\"data row8 col5\" >MICHAEL MORRIS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_d7a87_level0_row9\" class=\"row_heading level0 row9\" >10</th>\n",
       "      <td id=\"T_d7a87_row9_col0\" class=\"data row9 col0\" >$             285,262</td>\n",
       "      <td id=\"T_d7a87_row9_col1\" class=\"data row9 col1\" >$              17,116</td>\n",
       "      <td id=\"T_d7a87_row9_col2\" class=\"data row9 col2\" >$             302,378</td>\n",
       "      <td id=\"T_d7a87_row9_col3\" class=\"data row9 col3\" >$             302,378</td>\n",
       "      <td id=\"T_d7a87_row9_col4\" class=\"data row9 col4\" >chief of department, (fire department)</td>\n",
       "      <td id=\"T_d7a87_row9_col5\" class=\"data row9 col5\" >JOANNE HAYES-WHITE</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x21a2db26fd0>"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head(10)[[\"BasePay\",\"OtherPay\",\"TotalPay\",\"TotalPayBenefits\",\"JobTitle\",\"EmployeeName\"]]\\\n",
    "            .style.format({\"JobTitle\": lambda x:x.lower(),\n",
    "                          \"EmployeeName\": lambda x:x.upper(),\n",
    "                          \"BasePay\": \"${:20,.0f}\", \n",
    "                          \"OtherPay\": \"${:20,.0f}\", \n",
    "                          \"TotalPay\": \"${:20,.0f}\",\n",
    "                          \"TotalPayBenefits\":\"${:20,.0f}\"})\\\n",
    "                  .apply_index(lambda x: np.where(x % 2 == 0, \"background-color: #28d6ff;\", \"background-color: #bd56fd\"))\\\n",
    "                  .apply_index(lambda x: np.where([col.startswith('T') for col in x], \"background-color: #4fea79;\", \"background-color: #fed460\"),axis=1)\\\n",
    "                  .format_index(lambda x: x.upper(), axis=1)\\\n",
    "                  .format_index(lambda x: x+1)\\\n",
    "                  .set_table_styles(\n",
    "                                        [{'selector': 'tr:hover',\n",
    "                                          'props': 'background-color: lightblue; font-size: 1em;'}]\n",
    "                                    )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "def make_pretty(styler):\n",
    "    styler.format({\"JobTitle\": lambda x:str(x).lower(),\n",
    "                          \"EmployeeName\": lambda x:str(x).upper(),\n",
    "                          \"BasePay\": \"${:20,.0f}\", \n",
    "                          \"OtherPay\": \"${:20,.0f}\", \n",
    "                          \"TotalPay\": \"${:20,.0f}\",\n",
    "                          \"OvertimePay\": \"${:20,.0f}\",\n",
    "                          \"TotalPayBenefits\":\"${:20,.0f}\"})\\\n",
    "                  .applymap(lambda x: f\"color: {'black' if isinstance(x,float) else('red' if str(x).startswith('D') or str(x).endswith('D') else '#3773ff')}\")\\\n",
    "                  .bar(subset=[\"BasePay\"], cmap='Pastel1')\\\n",
    "                  .apply_index(lambda x: np.where(x % 2 == 0, \"background-color: #28d6ff;\", \"background-color: #bd56fd\"))\\\n",
    "                  .apply_index(lambda x: np.where([col.startswith('T') for col in x], \"background-color: #4fea79;\", \"background-color: #fbbc09\"),axis=1)\\\n",
    "                  .format_index(lambda x: x.upper(), axis=1)\\\n",
    "                  .format_index(lambda x: x+1)\\\n",
    "                  .set_table_styles([{'selector': 'tr:hover',\n",
    "                                          'props': 'background-color: lightblue; font-size: 1em;'}])\n",
    "                                    \n",
    "    return styler"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style type=\"text/css\">\n",
       "#T_6b3c0 tr:hover {\n",
       "  background-color: lightblue;\n",
       "  font-size: 1em;\n",
       "}\n",
       "#T_6b3c0_row0_col0, #T_6b3c0_row0_col2, #T_6b3c0_row0_col8, #T_6b3c0_row0_col9, #T_6b3c0_row1_col0, #T_6b3c0_row1_col1, #T_6b3c0_row1_col2, #T_6b3c0_row1_col8, #T_6b3c0_row1_col9, #T_6b3c0_row2_col0, #T_6b3c0_row2_col1, #T_6b3c0_row2_col2, #T_6b3c0_row2_col8, #T_6b3c0_row2_col9, #T_6b3c0_row3_col0, #T_6b3c0_row3_col1, #T_6b3c0_row3_col2, #T_6b3c0_row3_col8, #T_6b3c0_row3_col9, #T_6b3c0_row4_col0, #T_6b3c0_row4_col1, #T_6b3c0_row4_col8, #T_6b3c0_row4_col9, #T_6b3c0_row5_col0, #T_6b3c0_row5_col2, #T_6b3c0_row5_col8, #T_6b3c0_row5_col9, #T_6b3c0_row6_col0, #T_6b3c0_row6_col1, #T_6b3c0_row6_col2, #T_6b3c0_row6_col8, #T_6b3c0_row6_col9, #T_6b3c0_row7_col0, #T_6b3c0_row7_col8, #T_6b3c0_row7_col9, #T_6b3c0_row8_col0, #T_6b3c0_row8_col1, #T_6b3c0_row8_col2, #T_6b3c0_row8_col8, #T_6b3c0_row8_col9, #T_6b3c0_row9_col0, #T_6b3c0_row9_col1, #T_6b3c0_row9_col2, #T_6b3c0_row9_col8, #T_6b3c0_row9_col9 {\n",
       "  color: #3773ff;\n",
       "}\n",
       "#T_6b3c0_row0_col1, #T_6b3c0_row4_col2, #T_6b3c0_row5_col1, #T_6b3c0_row7_col1, #T_6b3c0_row7_col2 {\n",
       "  color: red;\n",
       "}\n",
       "#T_6b3c0_row0_col3 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #ffffcc 58.7%, transparent 58.7%);\n",
       "}\n",
       "#T_6b3c0_row0_col4, #T_6b3c0_row0_col5, #T_6b3c0_row0_col6, #T_6b3c0_row0_col7, #T_6b3c0_row1_col4, #T_6b3c0_row1_col5, #T_6b3c0_row1_col6, #T_6b3c0_row1_col7, #T_6b3c0_row2_col4, #T_6b3c0_row2_col5, #T_6b3c0_row2_col6, #T_6b3c0_row2_col7, #T_6b3c0_row3_col4, #T_6b3c0_row3_col5, #T_6b3c0_row3_col6, #T_6b3c0_row3_col7, #T_6b3c0_row4_col4, #T_6b3c0_row4_col5, #T_6b3c0_row4_col6, #T_6b3c0_row4_col7, #T_6b3c0_row5_col4, #T_6b3c0_row5_col5, #T_6b3c0_row5_col6, #T_6b3c0_row5_col7, #T_6b3c0_row6_col4, #T_6b3c0_row6_col5, #T_6b3c0_row6_col6, #T_6b3c0_row6_col7, #T_6b3c0_row7_col4, #T_6b3c0_row7_col5, #T_6b3c0_row7_col6, #T_6b3c0_row7_col7, #T_6b3c0_row8_col4, #T_6b3c0_row8_col5, #T_6b3c0_row8_col6, #T_6b3c0_row8_col7, #T_6b3c0_row9_col4, #T_6b3c0_row9_col5, #T_6b3c0_row9_col6, #T_6b3c0_row9_col7 {\n",
       "  color: black;\n",
       "}\n",
       "#T_6b3c0_row1_col3 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #fed9a6 54.7%, transparent 54.7%);\n",
       "}\n",
       "#T_6b3c0_row2_col3 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #e5d8bd 74.6%, transparent 74.6%);\n",
       "}\n",
       "#T_6b3c0_row3_col3 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #ccebc5 27.3%, transparent 27.3%);\n",
       "}\n",
       "#T_6b3c0_row4_col3 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #fed9a6 47.1%, transparent 47.1%);\n",
       "}\n",
       "#T_6b3c0_row5_col3 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #decbe4 41.6%, transparent 41.6%);\n",
       "}\n",
       "#T_6b3c0_row6_col3 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #ccebc5 32.4%, transparent 32.4%);\n",
       "}\n",
       "#T_6b3c0_row7_col3 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #f2f2f2 89.9%, transparent 89.9%);\n",
       "}\n",
       "#T_6b3c0_row8_col3 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #ffffcc 62.0%, transparent 62.0%);\n",
       "}\n",
       "#T_6b3c0_row9_col3 {\n",
       "  color: black;\n",
       "  width: 10em;\n",
       "  background: linear-gradient(90deg, #f2f2f2 100.0%, transparent 100.0%);\n",
       "}\n",
       "#T_6b3c0_level0_row0, #T_6b3c0_level0_row2, #T_6b3c0_level0_row4, #T_6b3c0_level0_row6, #T_6b3c0_level0_row8 {\n",
       "  background-color: #28d6ff;\n",
       "}\n",
       "#T_6b3c0_level0_row1, #T_6b3c0_level0_row3, #T_6b3c0_level0_row5, #T_6b3c0_level0_row7, #T_6b3c0_level0_row9 {\n",
       "  background-color: #bd56fd;\n",
       "}\n",
       "#T_6b3c0_level0_col0, #T_6b3c0_level0_col1, #T_6b3c0_level0_col2, #T_6b3c0_level0_col3, #T_6b3c0_level0_col4, #T_6b3c0_level0_col5, #T_6b3c0_level0_col8, #T_6b3c0_level0_col9 {\n",
       "  background-color: #fbbc09;\n",
       "}\n",
       "#T_6b3c0_level0_col6, #T_6b3c0_level0_col7 {\n",
       "  background-color: #4fea79;\n",
       "}\n",
       "</style>\n",
       "<table id=\"T_6b3c0\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th class=\"blank level0\" >&nbsp;</th>\n",
       "      <th id=\"T_6b3c0_level0_col0\" class=\"col_heading level0 col0\" >ID</th>\n",
       "      <th id=\"T_6b3c0_level0_col1\" class=\"col_heading level0 col1\" >EMPLOYEENAME</th>\n",
       "      <th id=\"T_6b3c0_level0_col2\" class=\"col_heading level0 col2\" >JOBTITLE</th>\n",
       "      <th id=\"T_6b3c0_level0_col3\" class=\"col_heading level0 col3\" >BASEPAY</th>\n",
       "      <th id=\"T_6b3c0_level0_col4\" class=\"col_heading level0 col4\" >OVERTIMEPAY</th>\n",
       "      <th id=\"T_6b3c0_level0_col5\" class=\"col_heading level0 col5\" >OTHERPAY</th>\n",
       "      <th id=\"T_6b3c0_level0_col6\" class=\"col_heading level0 col6\" >TOTALPAY</th>\n",
       "      <th id=\"T_6b3c0_level0_col7\" class=\"col_heading level0 col7\" >TOTALPAYBENEFITS</th>\n",
       "      <th id=\"T_6b3c0_level0_col8\" class=\"col_heading level0 col8\" >YEAR</th>\n",
       "      <th id=\"T_6b3c0_level0_col9\" class=\"col_heading level0 col9\" >AGENCY</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th id=\"T_6b3c0_level0_row0\" class=\"row_heading level0 row0\" >1</th>\n",
       "      <td id=\"T_6b3c0_row0_col0\" class=\"data row0 col0\" >1</td>\n",
       "      <td id=\"T_6b3c0_row0_col1\" class=\"data row0 col1\" >NATHANIEL FORD</td>\n",
       "      <td id=\"T_6b3c0_row0_col2\" class=\"data row0 col2\" >general manager-metropolitan transit authority</td>\n",
       "      <td id=\"T_6b3c0_row0_col3\" class=\"data row0 col3\" >$             167,411</td>\n",
       "      <td id=\"T_6b3c0_row0_col4\" class=\"data row0 col4\" >$                   0</td>\n",
       "      <td id=\"T_6b3c0_row0_col5\" class=\"data row0 col5\" >$             400,184</td>\n",
       "      <td id=\"T_6b3c0_row0_col6\" class=\"data row0 col6\" >$             567,595</td>\n",
       "      <td id=\"T_6b3c0_row0_col7\" class=\"data row0 col7\" >$             567,595</td>\n",
       "      <td id=\"T_6b3c0_row0_col8\" class=\"data row0 col8\" >2011</td>\n",
       "      <td id=\"T_6b3c0_row0_col9\" class=\"data row0 col9\" >San Francisco</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_6b3c0_level0_row1\" class=\"row_heading level0 row1\" >2</th>\n",
       "      <td id=\"T_6b3c0_row1_col0\" class=\"data row1 col0\" >2</td>\n",
       "      <td id=\"T_6b3c0_row1_col1\" class=\"data row1 col1\" >GARY JIMENEZ</td>\n",
       "      <td id=\"T_6b3c0_row1_col2\" class=\"data row1 col2\" >captain iii (police department)</td>\n",
       "      <td id=\"T_6b3c0_row1_col3\" class=\"data row1 col3\" >$             155,966</td>\n",
       "      <td id=\"T_6b3c0_row1_col4\" class=\"data row1 col4\" >$             245,132</td>\n",
       "      <td id=\"T_6b3c0_row1_col5\" class=\"data row1 col5\" >$             137,811</td>\n",
       "      <td id=\"T_6b3c0_row1_col6\" class=\"data row1 col6\" >$             538,909</td>\n",
       "      <td id=\"T_6b3c0_row1_col7\" class=\"data row1 col7\" >$             538,909</td>\n",
       "      <td id=\"T_6b3c0_row1_col8\" class=\"data row1 col8\" >2011</td>\n",
       "      <td id=\"T_6b3c0_row1_col9\" class=\"data row1 col9\" >San Francisco</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_6b3c0_level0_row2\" class=\"row_heading level0 row2\" >3</th>\n",
       "      <td id=\"T_6b3c0_row2_col0\" class=\"data row2 col0\" >3</td>\n",
       "      <td id=\"T_6b3c0_row2_col1\" class=\"data row2 col1\" >ALBERT PARDINI</td>\n",
       "      <td id=\"T_6b3c0_row2_col2\" class=\"data row2 col2\" >captain iii (police department)</td>\n",
       "      <td id=\"T_6b3c0_row2_col3\" class=\"data row2 col3\" >$             212,739</td>\n",
       "      <td id=\"T_6b3c0_row2_col4\" class=\"data row2 col4\" >$             106,088</td>\n",
       "      <td id=\"T_6b3c0_row2_col5\" class=\"data row2 col5\" >$              16,453</td>\n",
       "      <td id=\"T_6b3c0_row2_col6\" class=\"data row2 col6\" >$             335,280</td>\n",
       "      <td id=\"T_6b3c0_row2_col7\" class=\"data row2 col7\" >$             335,280</td>\n",
       "      <td id=\"T_6b3c0_row2_col8\" class=\"data row2 col8\" >2011</td>\n",
       "      <td id=\"T_6b3c0_row2_col9\" class=\"data row2 col9\" >San Francisco</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_6b3c0_level0_row3\" class=\"row_heading level0 row3\" >4</th>\n",
       "      <td id=\"T_6b3c0_row3_col0\" class=\"data row3 col0\" >4</td>\n",
       "      <td id=\"T_6b3c0_row3_col1\" class=\"data row3 col1\" >CHRISTOPHER CHONG</td>\n",
       "      <td id=\"T_6b3c0_row3_col2\" class=\"data row3 col2\" >wire rope cable maintenance mechanic</td>\n",
       "      <td id=\"T_6b3c0_row3_col3\" class=\"data row3 col3\" >$              77,916</td>\n",
       "      <td id=\"T_6b3c0_row3_col4\" class=\"data row3 col4\" >$              56,121</td>\n",
       "      <td id=\"T_6b3c0_row3_col5\" class=\"data row3 col5\" >$             198,307</td>\n",
       "      <td id=\"T_6b3c0_row3_col6\" class=\"data row3 col6\" >$             332,344</td>\n",
       "      <td id=\"T_6b3c0_row3_col7\" class=\"data row3 col7\" >$             332,344</td>\n",
       "      <td id=\"T_6b3c0_row3_col8\" class=\"data row3 col8\" >2011</td>\n",
       "      <td id=\"T_6b3c0_row3_col9\" class=\"data row3 col9\" >San Francisco</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_6b3c0_level0_row4\" class=\"row_heading level0 row4\" >5</th>\n",
       "      <td id=\"T_6b3c0_row4_col0\" class=\"data row4 col0\" >5</td>\n",
       "      <td id=\"T_6b3c0_row4_col1\" class=\"data row4 col1\" >PATRICK GARDNER</td>\n",
       "      <td id=\"T_6b3c0_row4_col2\" class=\"data row4 col2\" >deputy chief of department,(fire department)</td>\n",
       "      <td id=\"T_6b3c0_row4_col3\" class=\"data row4 col3\" >$             134,402</td>\n",
       "      <td id=\"T_6b3c0_row4_col4\" class=\"data row4 col4\" >$               9,737</td>\n",
       "      <td id=\"T_6b3c0_row4_col5\" class=\"data row4 col5\" >$             182,235</td>\n",
       "      <td id=\"T_6b3c0_row4_col6\" class=\"data row4 col6\" >$             326,373</td>\n",
       "      <td id=\"T_6b3c0_row4_col7\" class=\"data row4 col7\" >$             326,373</td>\n",
       "      <td id=\"T_6b3c0_row4_col8\" class=\"data row4 col8\" >2011</td>\n",
       "      <td id=\"T_6b3c0_row4_col9\" class=\"data row4 col9\" >San Francisco</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_6b3c0_level0_row5\" class=\"row_heading level0 row5\" >6</th>\n",
       "      <td id=\"T_6b3c0_row5_col0\" class=\"data row5 col0\" >6</td>\n",
       "      <td id=\"T_6b3c0_row5_col1\" class=\"data row5 col1\" >DAVID SULLIVAN</td>\n",
       "      <td id=\"T_6b3c0_row5_col2\" class=\"data row5 col2\" >assistant deputy chief ii</td>\n",
       "      <td id=\"T_6b3c0_row5_col3\" class=\"data row5 col3\" >$             118,602</td>\n",
       "      <td id=\"T_6b3c0_row5_col4\" class=\"data row5 col4\" >$               8,601</td>\n",
       "      <td id=\"T_6b3c0_row5_col5\" class=\"data row5 col5\" >$             189,083</td>\n",
       "      <td id=\"T_6b3c0_row5_col6\" class=\"data row5 col6\" >$             316,286</td>\n",
       "      <td id=\"T_6b3c0_row5_col7\" class=\"data row5 col7\" >$             316,286</td>\n",
       "      <td id=\"T_6b3c0_row5_col8\" class=\"data row5 col8\" >2011</td>\n",
       "      <td id=\"T_6b3c0_row5_col9\" class=\"data row5 col9\" >San Francisco</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_6b3c0_level0_row6\" class=\"row_heading level0 row6\" >7</th>\n",
       "      <td id=\"T_6b3c0_row6_col0\" class=\"data row6 col0\" >7</td>\n",
       "      <td id=\"T_6b3c0_row6_col1\" class=\"data row6 col1\" >ALSON LEE</td>\n",
       "      <td id=\"T_6b3c0_row6_col2\" class=\"data row6 col2\" >battalion chief, (fire department)</td>\n",
       "      <td id=\"T_6b3c0_row6_col3\" class=\"data row6 col3\" >$              92,492</td>\n",
       "      <td id=\"T_6b3c0_row6_col4\" class=\"data row6 col4\" >$              89,063</td>\n",
       "      <td id=\"T_6b3c0_row6_col5\" class=\"data row6 col5\" >$             134,426</td>\n",
       "      <td id=\"T_6b3c0_row6_col6\" class=\"data row6 col6\" >$             315,981</td>\n",
       "      <td id=\"T_6b3c0_row6_col7\" class=\"data row6 col7\" >$             315,981</td>\n",
       "      <td id=\"T_6b3c0_row6_col8\" class=\"data row6 col8\" >2011</td>\n",
       "      <td id=\"T_6b3c0_row6_col9\" class=\"data row6 col9\" >San Francisco</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_6b3c0_level0_row7\" class=\"row_heading level0 row7\" >8</th>\n",
       "      <td id=\"T_6b3c0_row7_col0\" class=\"data row7 col0\" >8</td>\n",
       "      <td id=\"T_6b3c0_row7_col1\" class=\"data row7 col1\" >DAVID KUSHNER</td>\n",
       "      <td id=\"T_6b3c0_row7_col2\" class=\"data row7 col2\" >deputy director of investments</td>\n",
       "      <td id=\"T_6b3c0_row7_col3\" class=\"data row7 col3\" >$             256,577</td>\n",
       "      <td id=\"T_6b3c0_row7_col4\" class=\"data row7 col4\" >$                   0</td>\n",
       "      <td id=\"T_6b3c0_row7_col5\" class=\"data row7 col5\" >$              51,322</td>\n",
       "      <td id=\"T_6b3c0_row7_col6\" class=\"data row7 col6\" >$             307,899</td>\n",
       "      <td id=\"T_6b3c0_row7_col7\" class=\"data row7 col7\" >$             307,899</td>\n",
       "      <td id=\"T_6b3c0_row7_col8\" class=\"data row7 col8\" >2011</td>\n",
       "      <td id=\"T_6b3c0_row7_col9\" class=\"data row7 col9\" >San Francisco</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_6b3c0_level0_row8\" class=\"row_heading level0 row8\" >9</th>\n",
       "      <td id=\"T_6b3c0_row8_col0\" class=\"data row8 col0\" >9</td>\n",
       "      <td id=\"T_6b3c0_row8_col1\" class=\"data row8 col1\" >MICHAEL MORRIS</td>\n",
       "      <td id=\"T_6b3c0_row8_col2\" class=\"data row8 col2\" >battalion chief, (fire department)</td>\n",
       "      <td id=\"T_6b3c0_row8_col3\" class=\"data row8 col3\" >$             176,933</td>\n",
       "      <td id=\"T_6b3c0_row8_col4\" class=\"data row8 col4\" >$              86,363</td>\n",
       "      <td id=\"T_6b3c0_row8_col5\" class=\"data row8 col5\" >$              40,132</td>\n",
       "      <td id=\"T_6b3c0_row8_col6\" class=\"data row8 col6\" >$             303,428</td>\n",
       "      <td id=\"T_6b3c0_row8_col7\" class=\"data row8 col7\" >$             303,428</td>\n",
       "      <td id=\"T_6b3c0_row8_col8\" class=\"data row8 col8\" >2011</td>\n",
       "      <td id=\"T_6b3c0_row8_col9\" class=\"data row8 col9\" >San Francisco</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_6b3c0_level0_row9\" class=\"row_heading level0 row9\" >10</th>\n",
       "      <td id=\"T_6b3c0_row9_col0\" class=\"data row9 col0\" >10</td>\n",
       "      <td id=\"T_6b3c0_row9_col1\" class=\"data row9 col1\" >JOANNE HAYES-WHITE</td>\n",
       "      <td id=\"T_6b3c0_row9_col2\" class=\"data row9 col2\" >chief of department, (fire department)</td>\n",
       "      <td id=\"T_6b3c0_row9_col3\" class=\"data row9 col3\" >$             285,262</td>\n",
       "      <td id=\"T_6b3c0_row9_col4\" class=\"data row9 col4\" >$                   0</td>\n",
       "      <td id=\"T_6b3c0_row9_col5\" class=\"data row9 col5\" >$              17,116</td>\n",
       "      <td id=\"T_6b3c0_row9_col6\" class=\"data row9 col6\" >$             302,378</td>\n",
       "      <td id=\"T_6b3c0_row9_col7\" class=\"data row9 col7\" >$             302,378</td>\n",
       "      <td id=\"T_6b3c0_row9_col8\" class=\"data row9 col8\" >2011</td>\n",
       "      <td id=\"T_6b3c0_row9_col9\" class=\"data row9 col9\" >San Francisco</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x21a2ca377f0>"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.drop(['Status','Notes','Benefits'],axis=1).head(10).style.pipe(make_pretty)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
